summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:42 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:42 +0000
commitf860c2f35b2f94e379d2ff7d5c13f54cd4a3132a (patch)
tree5808b087a5eb9f5d251932d6828565f6c5d4ed9e /sca-java-1.x/branches
parent587877fcbd358e233f653e01c4b3ed3354203626 (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835119 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches')
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/bundle/pom.xml301
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/manifest/pom.xml279
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/pom.xml216
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/bin.xml152
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/src.xml103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/CHANGES72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/DISCLAIMER7
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/README19
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/RELEASE_NOTES58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/INSTALL23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/LICENSE1689
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/NOTICE40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/BUILDING48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/LICENSE285
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/NOTICE33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/distribution/src/main/xsl/srcbuild_paths.xsl56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp130
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java341
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl272
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java157
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl704
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/bindings/pom.xml42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/resources/CallBackApiTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/resources/CallBackBasicTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java142
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java146
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/resources/CallBackIdClient.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java193
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java173
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorClient.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/ContributionTest.composite24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/Calculator.composite51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java238
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/repository/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java490
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java147
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/resources/ConversationsTest.composite43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/pom.xml120
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java123
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/generate.xsd61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/wsdl/Dummy.txt4
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xml30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Interop.xsd138
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xsd35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Person.xsd30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/datagraph.xsd88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd221
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.pngbin0 -> 31222 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.svg117
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.pngbin0 -> 14106 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.svg242
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.pngbin0 -> 23179 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.svg352
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/pom.xml190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm113
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/generate.xml159
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/pom.xml218
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml172
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/greeter.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/readme.html157
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/pom.xml219
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/generate.xml173
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/pom.xml.vm217
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/pom.xml189
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java122
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java84
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/pom.xml161
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java122
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java84
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl141
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl148
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java120
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/ExceptionTest.composite27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/intracomposite.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/pom.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/BasicService.composite29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/MathService.composite29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java96
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/resources/OperationOverload.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/pom.xml52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/OuterPropertyTest.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/PropertyTest.composite193
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/fileProperty.txt21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/manyValuesFileProperty.txt23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java186
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/CompositeClient.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Source.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Target.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/TargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentAImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentCImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentEImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentFImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/Service1.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite1.composite42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite2.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite3.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite2.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/OuterComposite.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/composite/CompositeTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/sample/RecursiveCompositeTest.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/BasicService.composite30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/CompositeTest.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/MathService.composite29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myListService.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInComposite.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInRecursive.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleService.composite35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalService.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myservice.composite52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java106
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/pom.xml135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/SDOWSDLTest.composite344
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/WSDLTest.composite371
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl467
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java146
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/pom.xml38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/pom.xml58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseArtifactProcessor.java686
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java271
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java503
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/XAttr.java122
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java159
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java113
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/StAXPerfTest.java105
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java115
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite119
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/.pmd21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/pom.xml44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java122
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java156
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java133
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java108
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultSCABindingFactory.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitable.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitor.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java1340
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java189
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java102
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java121
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java157
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java151
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java116
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java91
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/util/PrintUtil.java172
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java212
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/pom.xml133
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/DefaultJSONRPCBindingFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingProcessor.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/module/JSONRPCModuleActivator.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java106
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCEntryPointServlet.java150
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCScriptServlet.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/util/JavaToSmd.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/JSONRPCBinding.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/server/jsonrpc.js484
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/pom.xml82
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/DefaultRMIBindingFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingConstants.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingImpl.java129
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingInvoker.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProvider.java244
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProviderFactory.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIModuleActivator.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIRuntimeException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/xml/RMIBindingProcessor.java169
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodExceptionTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceExceptionTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/NOTICE14
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/RMIBindingTest.composite44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/pom.xml181
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/assembly/axis2.xml306
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2AsyncBindingInvoker.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingInvoker.java146
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingProviderFactory.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2CallbackInvocationHandler.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ModuleActivator.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2OneWayBindingInvoker.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java267
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallback.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java108
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java418
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceCallbackTargetInvoker.java105
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInMessageReceiver.java65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java128
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java300
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyAxisConfigurator.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyDispatcher.java101
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyListingAgent.java334
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/axis2/engine/config/axis2.xml306
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceTestCase.java83
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceTestCase.java104
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Greeter.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/GreetingCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldComponent.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldMultiService.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM2.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMComponent.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMService.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldTestCaseFIXME.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiServiceTestCase.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleServiceTestCase.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURITestCase.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURITestCase.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiService.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleService.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURI.composite49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURI.composite49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om-uri.wsdl78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.wsdl78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/questionmark-wsdl.composite38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/pom.xml61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java334
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java121
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java194
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java242
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/CancelTimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/StopTimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/Timer.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerListener.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerManager.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/RemoteWorkItem.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/Work.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkCompletedException.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkEvent.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkItem.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkListener.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkManager.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkRejectedException.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.checkstyle25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionExportImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImportImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/ModelResolverImpl.java87
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java106
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataLoaderImpl.java132
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java266
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java332
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidValueException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java704
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java182
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ArtifactResolverTestCase.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataLoaderTestCase.java96
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jarbin0 -> 26901 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/repository/sample-calculator.jarbin0 -> 29164 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.composite22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.ext0
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/pom.xml44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java91
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionExport.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionImport.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessor.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessorExtensionPoint.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java178
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/AbstractContributionException.java124
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoader.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoaderException.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWireException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/InvalidConfigurationException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.checkstyle25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/pom.xml82
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/module/DataBindingModuleActivator.java151
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Exception2ExceptionTransformer.java126
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java203
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java185
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingRuntimeWireProcessor.java150
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataTransformationInteceptor.java224
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java.fixme229
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/pom.xml111
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/doc/Context Model.emx673
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java132
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/test/resources/org/apache/tuscany/spi/util/stax/test.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/pom.xml94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java211
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java195
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java182
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java164
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java118
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorClient.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallableReferenceImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallbackReferenceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextProvider.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/RequestContextImpl.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ServiceReferenceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AbstractInvocationHandler.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java126
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyService.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java117
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java174
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/ActivationException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivator.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java597
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/EndpointReferenceImpl.java128
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeAssemblyFactory.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentImpl.java128
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentReferenceImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentServiceImpl.java109
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProvider.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProviderFactory.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeWireImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java146
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java182
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java195
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/util/IOHelper.java182
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java167
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java220
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java166
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectCreationException.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/SingletonObjectFactory.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/AbstractLifecycle.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/CoreRuntimeException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/InstanceWrapper.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Lifecycle.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/PersistenceException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Scope.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainer.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainerFactory.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeIdentifier.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeNotFoundException.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeRegistry.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedImplementationProvider.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedRuntimeComponent.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetDestructionException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInitializationException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvocationException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvokerCreationException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetNotFoundException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetResolutionException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java98
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/AsyncTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadContextPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadNamePojo.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterface.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterfaceImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponent.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponentImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeDestroyOnlyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitDestroyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitOnlyComponent.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponent.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponentImpl.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeDestroyOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojoImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedEagerInitPojo.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojoImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTargetImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeDestroyOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitOnlyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitDestroyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTarget.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Source.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SourceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponentImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Target.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/TargetImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java165
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/AssertionTestCase.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/SingletonObjectFactoryTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/.ruleset191
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/pom.xml91
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java37
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java59
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java52
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java108
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java103
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xml51
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xsd137
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/order.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/.ruleset191
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/pom.xml147
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java176
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java114
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBExceptionHandler.java107
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java123
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXWSJavaInterfaceProcessor.java101
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java67
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/module/JAXBDataBindingModuleActivator.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java128
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java80
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java160
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java63
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/resources/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.checkstyle25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.ruleset191
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/pom.xml131
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObjectSerializer.java427
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/module/SDOAxiomModuleActivator.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/stock.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.checkstyle25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.ruleset191
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/NOTICE6
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/pom.xml114
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java58
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DuplicateHelperContextException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessor.java110
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistry.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistryImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java78
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java192
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java106
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java122
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandler.java124
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java99
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java59
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java63
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java64
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/api/HelperContext.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/module/SDODataBindingModuleActivator.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessorTestCase.java83
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java110
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandlerTestCase.java82
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java61
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/ipo.xsd136
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-core.xsd233
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/stock.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xml27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xsd38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/.checkstyle25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/pom.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java71
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java116
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java90
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/ExceptionHandler.java57
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java44
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java79
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java63
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java49
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java149
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java69
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java357
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java91
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java96
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java167
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java392
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java941
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReader.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java226
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java295
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanUtil.java196
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java129
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java310
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java403
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java347
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java279
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java63
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java244
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java64
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java256
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java52
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java86
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java54
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java56
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java230
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java451
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java857
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java70
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java285
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java115
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java45
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java119
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java107
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java133
-rwxr-xr-xsca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.pmd21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/pom.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java267
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java111
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java213
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java348
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java243
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java173
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java282
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUD.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementation.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementationFactory.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java111
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java138
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProvider.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProviderFactory.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDInvoker.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java112
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/crud.composite30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/test.txt16
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/pom.xml46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/DefaultServletHostExtensionPoint.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ExtensibleServletHost.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHost.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHostExtensionPoint.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletMappingException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/module/HTTPRuntimeModuleActivator.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/pom.xml38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/DefaultRMIHost.java129
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHost.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostRuntimeException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/module/RMIRuntimeModuleActivator.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/test/java/org/apache/tuscany/sca/rmi/RMIHostImplTestCase.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/pom.xml53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyContextListener.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppModuleActivator.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java87
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java278
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java170
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/pom.xml83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java220
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java170
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/JavaPropertyValueObjectFactory.java204
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/TargetMethodNotFoundException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/EventInvoker.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidResourceTypeException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactory.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvoker.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoAccessorException.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoMultiplicityTypeException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ObjectCallbackException.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactory.java120
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java87
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentInfo.java414
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java174
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaTargetInvoker.java159
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PassByValueInvoker.java117
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentContextFactory.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoConfiguration.java218
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvoker.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvokerInvoker.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatter.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterImpl.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/FormatterRegistry.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/InvalidLevelException.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingMonitorFactory.java118
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactory.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactoryUtil.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/NullMonitorFactory.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ProxyMonitorFactory.java231
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ModelHelper.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactoryTestCase.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactoryTestCase.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/AbstractConversationTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationIdleExpireTestCase.java.FIXME149
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationMaxAgeExpireTestCase.java.FIXME153
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationStartStopEndTestCase.java.FIXME147
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ReferenceInjectionTestCase.java.FIXME79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/AsyncTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadContextPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadNamePojo.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterface.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterfaceImpl.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponent.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponentImpl.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeDestroyOnlyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitDestroyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitOnlyComponent.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponent.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponentImpl.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeDestroyOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockFactory.java.FIXME214
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockStaticInvoker.java94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockSyncInterceptor.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojoImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedEagerInitPojo.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojo.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojoImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTarget.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTargetImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeDestroyOnlyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitDestroyComponent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitOnlyComponent.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponentImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitDestroyComponent.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitOnlyComponent.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTarget.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Source.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SourceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponent.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponentImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Target.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/TargetImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingTestCase.java152
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java182
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/pom.xml57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Monitor.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorExtensionPoint.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DuplicatePropertyException.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/ExtensibleJavaClassIntrospector.java126
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IllegalPropertyException.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IntrospectionException.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospector.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospectorExtensionPoint.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java125
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java167
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java658
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java448
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java164
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java171
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java134
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java159
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java188
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java80
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java168
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java197
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java158
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java166
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java153
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java188
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java144
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java116
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java315
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java411
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java153
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java406
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java213
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java224
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java116
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java169
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java152
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java120
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.pmd21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/pom.xml38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java186
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java84
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java223
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java156
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/LICENSE251
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/NOTICE17
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/pom.xml131
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractImplementation.java101
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractStAXArtifactProcessor.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/PropertyValueObjectFactory.java226
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/ResourceHelper.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptArtifactProcessor.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProvider.java119
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProviderFactory.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptModuleActivator.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java445
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js23
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/pom.xml43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/pom.xml56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/DefaultJavaInterfaceIntrospectorExtensionPoint.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java147
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospectorExtensionPoint.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java157
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java102
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java126
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java117
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/pom.xml39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java94
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java129
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java114
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/pom.xml43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/module/WSDLInterfaceRuntimeModuleActivator.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/pom.xml50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospector.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/InvalidWSDLException.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospector.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperation.java556
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java195
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospectorTestCase.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/TestModelResolver.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationTestCase.java124
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java118
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd136
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java99
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/.checkstyle24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/.pmd20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/.ruleset190
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/pom.xml31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java115
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java160
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java188
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java264
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java160
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java285
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java60
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java82
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java115
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java140
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java124
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java366
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/pom.xml198
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java435
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java89
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java235
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java524
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java521
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java410
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java225
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java373
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java143
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/NOTICE14
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl116
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java108
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/AccountService.wsdl242
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/helloworld.wsdl121
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/sequences.xsd100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java153
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/pom.xml45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java152
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java92
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/pom.xml38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java87
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/pom.xml103
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/pom.xml59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java109
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Constants.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/DISCLAIMER8
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/LICENSE205
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/NOTICE6
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/pom.xml198
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java224
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java235
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java349
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java143
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/LICENSE.txt202
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/NOTICE14
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/README.txt35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl116
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/AccountService.wsdl242
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/helloworld.wsdl121
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/interopdoc.wsdl180
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/sequences.xsd100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/pom.xml192
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/README245
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/README104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.pngbin0 -> 7846 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.svg174
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/EchoComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/resources/EchoBinding.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/README70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/pom.xml83
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/DefaultEchoBindingFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBinding.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBindingFactory.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingImpl.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingProcessor.java73
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/module/EchoModuleActivator.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingInvoker.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingProviderFactory.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoReferenceBindingProvider.java62
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoServiceBindingProvider.java74
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoServer.java72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoService.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/Echo.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoReferenceTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoServiceTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/resources/EchoBinding.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/README137
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.pngbin0 -> 23615 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.svg412
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java58
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java52
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/README137
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.pngbin0 -> 20814 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.svg330
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/pom.xml68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java68
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/README100
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.pngbin0 -> 23064 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.svg334
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorClient.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorService.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/Calculator.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py20
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.componentType30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb21
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/README93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/build.xml86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.pngbin0 -> 22916 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.svg358
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorClient.java47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/resources/Calculator.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/META-INF/sca-contribution.xml22
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/WEB-INF/web.xml35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/calc.jsp50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/test/java/calculator/CalculatorTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/README88
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.pngbin0 -> 20552 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.svg329
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorClient.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorService.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/resources/Calculator.composite47
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/test/java/calculator/CalculatorTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/README140
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.pngbin0 -> 23907 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.svg408
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/pom.xml76
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java59
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Echo.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface1.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface2.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/EchoDataBinding.composite54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/README86
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build-dojo.xml91
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build.xml106
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.pngbin0 -> 9947 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg177
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/pom.xml125
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite36
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html134
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/style.css4
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/README147
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.pngbin0 -> 7549 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.svg150
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/pom.xml79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/logging.properties30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldServerTest.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/README128
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.pngbin0 -> 158 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.svg149
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/pom.xml79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java46
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/helloworldws.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl79
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/README104
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.pngbin0 -> 47415 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.svg658
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/pom.xml66
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/CompositeClient.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Source.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceCallback.java24
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceImpl.java55
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Target.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/TargetImpl.java41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite.composite41
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite2.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml25
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/OuterComposite.composite39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/README113
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/build.xml75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.pngbin0 -> 4227 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.svg135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java53
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/resources/crud.composite30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java57
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/README78
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/pom.xml70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUD.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementation.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementationFactory.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/DefaultCRUDImplementationFactory.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/backend/ResourceManager.java109
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationProcessor.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/module/CRUDModuleActivator.java75
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProvider.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProviderFactory.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDInvoker.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/java/crud/CRUDTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/resources/crud.composite30
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClient.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanService.java37
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java63
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/resources/loanapplication.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java81
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/pom.xml64
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/README85
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/pom.xml71
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.pngbin0 -> 10202 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.svg200
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java61
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java26
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java56
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java35
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java43
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/resources/BigBank.composite33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/README93
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.pngbin0 -> 137 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.svg150
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClient.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyService.java32
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java51
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java38
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/resources/simplecallback.composite34
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/README97
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/build.xml72
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/pom.xml65
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Customer.java33
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java44
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Retailer.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Shipper.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java40
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Warehouse.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java39
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/resources/supplychain.composite45
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java50
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.pngbin0 -> 3898 bytes
-rw-r--r--sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.svg228
2279 files changed, 172211 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/bundle/pom.xml b/sca-java-1.x/branches/sca-java-0.90/distribution/bundle/pom.xml
new file mode 100644
index 0000000000..f65fb7d788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/bundle/pom.xml
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-bundle</artifactId>
+ <name>Apache Tuscany Bundle Jar</name>
+ <packaging>jar</packaging>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-java-dsl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+
+<!-- don't want the tools in the bundle jar?
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-maven-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+-->
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>shade-maven-plugin</artifactId>
+ <version>1.0-alpha-7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedGroupFilter>org.apache.tuscany</shadedGroupFilter>
+ <shadedArtifactAttached>false</shadedArtifactAttached>
+
+ <artifactSet>
+ <excludes>
+ <exclude>org.apache.tuscany.sdo:tuscany-sdo-impl</exclude>
+ </excludes>
+ </artifactSet>
+
+ <transformers>
+ <transformer implementation="org.codehaus.mojo.shade.resource.AppendingTransformer">
+ <resource>META-INF/services/org.apache.tuscany.sca.core.ModuleActivator</resource>
+ </transformer>
+ </transformers>
+
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/manifest/pom.xml b/sca-java-1.x/branches/sca-java-0.90/distribution/manifest/pom.xml
new file mode 100644
index 0000000000..a94e936725
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/manifest/pom.xml
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-sca-manifest</artifactId>
+ <name>Apache Tuscany Manifest Jar</name>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-java-dsl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-core-spring</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-interface-wsdl-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-maven-java2wsdl</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <finalName>tuscany-sca-manifest</finalName>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ </manifest>
+ <manifestEntries>
+ <!-- Add an entry for the renamed bundle jar in the distro -->
+ <Class-Path>tuscany-sca-all-${pom.version}.jar</Class-Path>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/pom.xml b/sca-java-1.x/branches/sca-java-0.90/distribution/pom.xml
new file mode 100644
index 0000000000..502fcf3183
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/pom.xml
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-distribution</artifactId>
+ <name>Apache Tuscany Distribution</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ <tuscany.version>${pom.version}</tuscany.version>
+ </properties>
+
+ <modules>
+ <module>bundle</module>
+ <module>manifest</module>
+ </modules>
+
+ <dependencies>
+ <dependency>
+ <groupId>${pom.groupId}</groupId>
+ <artifactId>tuscany-bundle</artifactId>
+ <version>${pom.version}</version>
+ <exclusions>
+ <!-- exclude things that get dragged in from other dependencies that we don't need to distribute -->
+ <!-- TODO: this should probably be done in the Tuscany module where the dependency is defined -->
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>avalon-framework</groupId>
+ <artifactId>avalon-framework</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <resources>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-javadoc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/javadoc</outputDirectory>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <classifier>javadoc</classifier>
+ <version>${pom.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <classifier>javadoc</classifier>
+ <version>${pom.version}</version>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ant-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-sources</id>
+ <phase>generate-sources</phase>
+
+ <goals>
+ <goal>ant</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution-package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/bin.xml</descriptor>
+ <descriptor>src/main/assembly/src.xml</descriptor>
+ </descriptors>
+ <tarLongFileMode>gnu</tarLongFileMode>
+ <finalName>apache-tuscany-sca-${pom.version}</finalName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-trax</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>process-sources-xsl</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <tasks>
+ <xslt style="${basedir}/src/main/xsl/srcbuild_paths.xsl" in="build.xml" out="${basedir}/target/srcbuild_paths.xml">
+ </xslt>
+
+ <pathconvert property="cp" refid="maven.runtime.classpath" />
+ <condition property="output.cp" value="set TUSCANY_CLASSPATH=${cp}">
+ <os family="windows" />
+ </condition>
+ <condition property="output.ext" value=".bat">
+ <os family="windows" />
+ </condition>
+ <property name="output.cp" value="export TUSCANY_CLASSPATH=${cp}" />
+ <property name="output.ext" value="" />
+
+ <echo file="${basedir}/target/srcbuild_env${output.ext}" message="${output.cp}" />
+ <echo file="${basedir}/target/version.properties" message="tuscany.version=${pom.version}" />
+ <!-- copy file="${basedir}/src/main/assembly/jbi.xml" tofile="${basedir}/target/jbi.xml" overwrite="yes">
+ <filterset>
+ <filter token="TUSCANY_VERSION" value="${pom.version}" />
+ </filterset>
+ </copy -->
+ <delete file="build.xml" />
+ </tasks>
+
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/bin.xml b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/bin.xml
new file mode 100644
index 0000000000..0b89611e16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/bin.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id></id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>dir</format>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+
+ <!-- Add the text files to the top-level directroy -->
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}</outputDirectory>
+ <includes>
+ <include>CHANGES</include>
+ <include>DISCLAIMER</include>
+ <include>README</include>
+ <include>RELEASE_NOTES</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/bin</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}</outputDirectory>
+ <includes>
+ <include>INSTALL</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+
+ <!-- Add javadoc to the doc directory -->
+ <fileSet>
+ <directory>target/javadoc</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/docs/javadoc</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+
+ <!-- Add all the samples to the samples directory -->
+ <fileSet>
+ <directory>../samples</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/samples</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>pom.xml</exclude>
+ <exclude>bigbank</exclude>
+ <exclude>bigbank/**/*</exclude>
+ <exclude>das-service</exclude>
+ <exclude>das-service/**/*</exclude>
+ <exclude>das-service-web</exclude>
+ <exclude>das-service-web/**/*</exclude>
+ <exclude>helloworld-jsonrpc/src/main/webapp/dojo</exclude>
+ <exclude>helloworld-jsonrpc/src/main/webapp/dojo/**/*</exclude>
+ <exclude>helloworld-ws-reference/work</exclude>
+ <exclude>helloworld-ws-reference/work/**/*</exclude>
+ <exclude>helloworld-ws-service/work</exclude>
+ <exclude>helloworld-ws-service/work/**/*</exclude>
+ <exclude>calculator-web/target/sample-calculator-web</exclude>
+ <exclude>calculator-web/target/sample-calculator-web/**/*</exclude>
+ <exclude>helloworld-jsonrpc/target/sample-helloworldjsonrpc</exclude>
+ <exclude>helloworld-jsonrpc/target/sample-helloworldjsonrpc/**/*</exclude>
+ <exclude>helloworld-jsonrpc/target/dojo-download</exclude>
+ <exclude>helloworld-jsonrpc/target/dojo-download/**/*</exclude>
+ <exclude>loanapplication</exclude>
+ <exclude>loanapplication/**/*</exclude>
+ <exclude>*/.classpath</exclude>
+ <exclude>*/.project</exclude>
+ <exclude>*/target/classes</exclude>
+ <exclude>*/target/classes/**/*</exclude>
+ <exclude>*/target/test-classes</exclude>
+ <exclude>*/target/test-classes/**/*</exclude>
+ <exclude>*/target/surefire-reports</exclude>
+ <exclude>*/target/surefire-reports/**/*</exclude>
+ </excludes>
+ </fileSet>
+
+ <!-- Add the generated tuscany manifest classpath jar to the lib directory -->
+ <fileSet>
+ <directory>manifest/target</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <includes>
+ <include>tuscany-sca-manifest.jar</include>
+ </includes>
+ </fileSet>
+
+ </fileSets>
+
+ <dependencySets>
+
+ <!-- Add all the Tuscany modules to the modules directory -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/modules</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:*</include>
+ </includes>
+ <!-- exclude the tuscany bundle jar from the modules directory -->
+ <excludes>
+ <exclude>org.apache.tuscany.sca:tuscany-bundle</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <!-- Add all the dependent jars to the lib directory -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <excludes>
+ <exclude>org.apache.tuscany.sca:*</exclude>
+ </excludes>
+ <scope>runtime</scope>
+ </dependencySet>
+
+ <!-- Add the Tuscany bundle jar to the lib directory renaming it to nicer name -->
+ <dependencySet>
+ <outputDirectory>tuscany-sca-${tuscany.version}/lib</outputDirectory>
+ <unpack>false</unpack>
+ <includes>
+ <include>org.apache.tuscany.sca:tuscany-bundle</include>
+ </includes>
+ <scope>runtime</scope>
+ <outputFileNameMapping>tuscany-sca-all-${version}.${extension}</outputFileNameMapping>
+ </dependencySet>
+
+ </dependencySets>
+
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/src.xml b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/src.xml
new file mode 100644
index 0000000000..dc519c891b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/assembly/src.xml
@@ -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.
+-->
+<assembly>
+ <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
+ <id>src</id>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <formats>
+ <format>tar.gz</format>
+ <format>zip</format>
+ </formats>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/release</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>CHANGES</include>
+ <include>DISCLAIMER</include>
+ <include>README</include>
+ <include>RELEASE_NOTES</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/release/src</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>BUILDING</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/maven-shared-archive-resources/META-INF</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>NOTICE</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>..</directory>
+ <outputDirectory>tuscany-sca-${tuscany.version}-src</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>contrib</exclude>
+ <exclude>contrib/**/*</exclude>
+ <exclude>doc</exclude>
+ <exclude>doc/**/*</exclude>
+ <exclude>**/target</exclude>
+ <exclude>**/target/**/*</exclude>
+ <exclude>**/build</exclude>
+ <exclude>**/build/**/*</exclude>
+ <exclude>**/.settings</exclude>
+ <exclude>**/.classpath</exclude>
+ <exclude>**/.project</exclude>
+ <exclude>**/.wtpmodules</exclude>
+ <exclude>**/surefire*</exclude>
+ <exclude>**/cobertura.ser</exclude>
+ <exclude>bin</exclude>
+ <exclude>bin/*</exclude>
+ <exclude>**/var/journal</exclude>
+ <exclude>**/build.out*</exclude>
+ <exclude>velocity.log</exclude>
+ <exclude>itest/velocity.log</exclude>
+ <exclude>itest/databindings/jaxbgen/velocity.log</exclude>
+ <exclude>modules/http-tomcat/work</exclude>
+ <exclude>modules/http-tomcat/work/**/*</exclude>
+ <exclude>modules/implementation-spring</exclude>
+ <exclude>modules/implementation-spring/**/*</exclude>
+ <exclude>samples/das-service</exclude>
+ <exclude>samples/das-service/**/*</exclude>
+ <exclude>samples/das-service-web</exclude>
+ <exclude>samples/das-service-web/**/*</exclude>
+ <exclude>samples/helloworld-jsonrpc/src/main/webapp/dojo</exclude>
+ <exclude>samples/helloworld-jsonrpc/src/main/webapp/dojo/**/*</exclude>
+ <exclude>samples/helloworld-ws-reference/work</exclude>
+ <exclude>samples/helloworld-ws-reference/work/**/*</exclude>
+ <exclude>samples/helloworld-ws-service/work</exclude>
+ <exclude>samples/helloworld-ws-service/work/**/*</exclude>
+ <exclude>samples/bigbank</exclude>
+ <exclude>samples/bigbank/**/*</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+</assembly>
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/CHANGES b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/CHANGES
new file mode 100644
index 0000000000..e3ebeeabd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/CHANGES
@@ -0,0 +1,72 @@
+Changed With Apache Tuscany SCA 0.90 (incubating)
+=================================================
+
+- Implementations for all of the Java Annotations and API Specification V1.0 found at
+ (http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications)
+ apart from the following.
+ @ComponentName
+ Conversation
+ RequestContext
+
+- New assembly model implementation taking into account SCA 1.0 artifacts
+ Data duplication between assembly model and runtime removed
+
+- Simple single process domain support
+ Contribution support to scope items being deployed into the runtime
+
+- Improved Package/Class naming consistency across modules
+
+- Extensions now loaded via Java service mechanism
+ Refactored extensions to use new SPIs (see below)
+
+- Maven and Ant based sample builds in the binary distribution
+
+- Implementation Extensions
+ Java
+ Script supporting (Ruby, Python, Groovy, JavaScript)
+
+- Binding Extensions
+ Axis2
+ RMI
+ JSONRPC
+
+-Databinding Extensions
+ Axiom
+ JAXB
+ SDO
+
+- Host environments
+ Embedded
+ Tomcat
+ Jetty
+ RMI
+
+- A clear set of SPIs intended to be stable over future releases
+ SCA assembly model
+ org.apache.tuscany.sca.assembly
+ org.apache.tuscany.sca.interfacedef
+ org.apache.tuscany.sca.interfacedef.java
+ org.apache.tuscany.sca.interfacedef.wsdl
+ org.apache.tuscany.sca.policy
+
+ SCA contribution model
+ org.apache.tuscany.sca.contribution
+
+ Runtime extensions
+ org.apache.tuscany.sca.core
+ org.apache.tuscany.sca.invocation
+ org.apache.tuscany.sca.provider
+ org.apache.tuscany.sca.runtime
+ org.apache.tuscany.sca.work
+
+ Data binding support
+ org.apache.tuscany.sca.databinding
+
+ Embedding Tuscany
+ org.apache.tuscany.sca.host.embedded
+
+ Servlet container integration
+ org.apache.tuscany.sca.http
+
+- For this point release a partial set of JavaDoc is provided to
+ be filled out as we close on release 1.0
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/DISCLAIMER
new file mode 100644
index 0000000000..a65af91c5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/DISCLAIMER
@@ -0,0 +1,7 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF. \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/README b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/README
new file mode 100644
index 0000000000..94c8e61cb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/README
@@ -0,0 +1,19 @@
+Apache Tuscany SCA 0.90 (incubating) June 2007 README
+=====================================================
+
+Welcome to the Tuscany SCA 0.90 release.
+
+See the RELEASE_NOTES file for information specific to this release.
+
+In the binary release see the INSTALL file for information on how to
+install the release.
+
+In the source distribution see the BUILDING file for information on
+building the source code.
+
+
+
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/RELEASE_NOTES b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/RELEASE_NOTES
new file mode 100644
index 0000000000..1d7e2f79b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/RELEASE_NOTES
@@ -0,0 +1,58 @@
+Apache Tuscany SCA 0.90 (incubating) June 2007 Release Notes
+============================================================
+
+Overview
+--------
+
+This 0.90 release of Apache Tuscany SCA represents a significant
+milestone on the road to 1.0.
+
+This release includes a substantial redesign and rewrite of parts
+of the Tuscany SCA runtime which has significantly improved usability
+compared with previous releases.
+
+Key features include:
+
+- now based on the final OSOA (http://www.osoa.org) 1.0 specifications;
+
+- clear, simple and stable SPI's to aid embedding and extending the runtime;
+
+- lightweight and modular, allowing users to pick and choose Tuscany modules
+ as required for their particular environments.
+
+The result of these improvements is that the Tuscany SCA runtime can now be
+used easily in any environment - standalone, within webapps, embedded in any
+application server, or even running inside an IDE.
+
+No special tools, packaging, or plugins are required to create SCA
+applications using Tuscany SCA. The standard Ant or Maven build tools,
+or the simple JDK command line tools, are all that is required to
+develop and use Tuscany SCA applications.
+
+The modular nature of Tuscany now enables a complete runtime for SCA assembly
+to be put together with less than 1MB of Tuscany code.
+
+See the CHANGES file for a detailed list of the features in this release.
+
+Support
+-------
+
+For more information on Apache Tuscany visit the website at:
+
+ http://incubator.apache.org/tuscany/
+
+Any issues with this release can be reported to Apache Tuscany
+using the mailing lists or in the JIRA issue tracker.
+
+ Mailing lists:
+
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-user/
+ http://mail-archives.apache.org/mod_mbox/ws-tuscany-dev/
+
+ Jira:
+
+ http://issues.apache.org/jira/browse/TUSCANY
+
+Thank you for using Apache Tuscany!
+
+The Tuscany Team.
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/INSTALL b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/INSTALL
new file mode 100644
index 0000000000..5d8263c7f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/INSTALL
@@ -0,0 +1,23 @@
+Installing the Apache Tuscany SCA 0.90 (incubating) June 2007 Release binary distribution
+=========================================================================================
+
+Unzip Tuscany binary distribution archive and you get the following:
+
+tuscany-sca-0.90-incubating
+ DISCLAIMER - the ASF incubation disclaimer
+ INSTALL - this help file
+ LICENSE - the Apache License and any dependecy licenses
+ NOTICE - attribution notices associated with the licenses
+ CHANGES - A note of the major changes in this version
+
+ /doc - Javadoc for the SCA APIs and the Tuscany SPIs
+
+ /lib - The tuscany-sca-all and tuscany-sca-manifest jars and all their dependencies
+
+ /modules - all of the individual Tuscany jars
+
+ /samples - all the Tuscany samples, see the README in that directory
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/LICENSE b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/LICENSE
new file mode 100644
index 0000000000..4bb604759f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/LICENSE
@@ -0,0 +1,1689 @@
+
+ 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 binary distribution includes a number of subcomponents
+with separate copyright notices and license terms. Your use of the
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================
+
+jaxen-1.1-beta-9.jar:
+
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * 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.
+
+ * Neither the name of the Jaxen Project nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS 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 COPYRIGHT OWNER
+OR 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.
+
+===============================================================================
+
+The EMF jars;
+ common-2.2.2.jar
+ ecore-2.2.2.jar
+ ecore-change-2.2.2.jar
+ ecore-xmi-2.2.2.jar
+ xsd-2.2.2.jar
+
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF
+THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and
+are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program by such
+Contributor itself or anyone acting on such Contributor's behalf.
+Contributions do not include additions to the Program which: (i) are
+separate modules of software distributed in conjunction with the
+Program under their own license agreement, and (ii) are not derivative
+works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its Contribution
+alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this
+Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free copyright
+license to reproduce, prepare derivative works of, publicly display,
+publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and
+object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+grants Recipient a non-exclusive, worldwide, royalty-free patent
+license under Licensed Patents to make, use, sell, offer to sell,
+import and otherwise transfer the Contribution of such Contributor, if
+any, in source code and object code form. This patent license shall
+apply to the combination of the Contribution and the Program if, at
+the time the Contribution is added by the Contributor, such addition
+of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other
+combinations which include the Contribution. No hardware per se is
+licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+licenses to its Contributions set forth herein, no assurances are
+provided by any Contributor that the Program does not infringe the
+patent or other intellectual property rights of any other entity. Each
+Contributor disclaims any liability to Recipient for claims brought by
+any other entity based on infringement of intellectual property rights
+or otherwise. As a condition to exercising the rights and licenses
+granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For
+example, if a third party patent license is required to allow
+Recipient to distribute the Program, it is Recipient's responsibility
+to acquire that license before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright
+license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form
+under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+and conditions, express and implied, including warranties or
+conditions of title and non-infringement, and implied warranties or
+conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+for damages, including direct, indirect, special, incidental and
+consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are
+offered by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable
+manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the
+Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third party
+against the Indemnified Contributor to the extent caused by the acts
+or omissions of such Commercial Contributor in connection with its
+distribution of the Program in a commercial product offering. The
+obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement.
+In order to qualify, an Indemnified Contributor must: a) promptly
+notify the Commercial Contributor in writing of such claim, and b)
+allow the Commercial Contributor to control, and cooperate with the
+Commercial Contributor in, the defense and any related settlement
+negotiations. The Indemnified Contributor may participate in any such
+claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial
+product offering, Product X. That Contributor is then a Commercial
+Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance
+claims and warranties are such Commercial Contributor's responsibility
+alone. Under this section, the Commercial Contributor would have to
+defend claims against the other Contributors related to those
+performance claims and warranties, and if a court requires any other
+Contributor to pay any damages as a result, the Commercial Contributor
+must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its
+exercise of rights under this Agreement , including but not limited to
+the risks and costs of program errors, compliance with applicable
+laws, damage to or loss of data, programs or equipment, and
+unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR
+ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
+WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
+DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+the Program itself (excluding combinations of the Program with other
+software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of
+the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it
+fails to comply with any of the material terms or conditions of this
+Agreement and does not cure such failure in a reasonable period of
+time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use
+and distribution of the Program as soon as reasonably practicable.
+However, Recipient's obligations under this Agreement and any licenses
+granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement,
+but in order to avoid inconsistency the Agreement is copyrighted and
+may only be modified in the following manner. The Agreement Steward
+reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement
+Steward has the right to modify this Agreement. The Eclipse Foundation
+is the initial Agreement Steward. The Eclipse Foundation may assign
+the responsibility to serve as the Agreement Steward to a suitable
+separate entity. Each new version of the Agreement will be given a
+distinguishing version number. The Program (including Contributions)
+may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the
+Agreement is published, Contributor may elect to distribute the
+Program (including its Contributions) under the new version. Except as
+expressly stated in Sections 2(a) and 2(b) above, Recipient receives
+no rights or licenses to the intellectual property of any Contributor
+under this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under this
+Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this Agreement
+more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.
+
+===============================================================================
+
+For the Rhino JavaScript engine js.jar:
+
+ 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.]
+
+
+===============================================================================
+Groovy:
+
+/*
+ $Id: LICENSE.txt 156 2003-09-26 17:36:37Z jstrachan $
+
+ Copyright 2003 (C) James Strachan and Bob Mcwhirter. 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 "groovy" 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 info@codehaus.org.
+
+ 4. Products derived from this Software may not be called "groovy"
+ nor may "groovy" appear in their names without prior written
+ permission of The Codehaus. "groovy" is a registered
+ trademark of The Codehaus.
+
+ 5. Due credit should be given to The Codehaus -
+ http://groovy.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.
+
+ */
+
+===============================================================================
+
+Jython:
+
+A. HISTORY OF THE SOFTWARE
+=======================
+
+JPython was created in late 1997 by Jim Hugunin. Jim was also the
+primary developer while he was at CNRI. In February 1999 Barry Warsaw
+took over as primary developer and released JPython version 1.1.
+
+In October 2000 Barry helped move the software to SourceForge
+where it was renamed to Jython. Jython 2.0 and on are licensed under
+the Jython specific license below.
+
+The standard library is covered by the Python Software Foundation
+license. See the LICENSE_CPython.txt file for details.
+
+The zxJDBC package was written by Brian Zimmer and originally licensed
+under the GNU Public License. The package is now covered by the Jython
+Software License.
+
+The command line interpreter is covered by the Apache Software
+License. See the LICENSE_Apache.txt file for details.
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING JYTHON
+================================
+
+Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Jython Developers
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of the Jython Developers nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESS 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 REGENTS OR
+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.
+
+
+
+
+JPython 1.1.x Software License.
+=========================
+
+______________________________________________________________________
+
+IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY.
+
+BY CLICKING ON THE "ACCEPT" BUTTON WHERE INDICATED, OR BY INSTALLING,
+COPYING OR OTHERWISE USING THE SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO
+THE TERMS AND CONDITIONS OF THIS AGREEMENT.
+
+______________________________________________________________________
+
+JPython version 1.1.x
+
+ 1. This LICENSE AGREEMENT is between the Corporation for National Research
+ Initiatives, having an office at 1895 Preston White Drive, Reston, VA
+ 20191 ("CNRI"), and the Individual or Organization ("Licensee")
+ accessing and using JPython version 1.1.x in source or binary form and
+ its associated documentation as provided herein ("Software").
+
+ 2. Subject to the terms and conditions of this License Agreement, CNRI
+ hereby grants Licensee a non-exclusive, non-transferable, royalty-free,
+ world-wide license to reproduce, analyze, test, perform and/or display
+ publicly, prepare derivative works, distribute, and otherwise use the
+ Software alone or in any derivative version, provided, however, that
+ CNRI's License Agreement and CNRI's notice of copyright, i.e.,
+ "Copyright ©1996-1999 Corporation for National Research Initiatives;
+ All Rights Reserved" are both retained in the Software, alone or in any
+ derivative version prepared by Licensee.
+
+ Alternatively, in lieu of CNRI's License Agreement, Licensee may
+ substitute the following text (omitting the quotes), provided, however,
+ that such text is displayed prominently in the Software alone or in any
+ derivative version prepared by Licensee: "JPython (Version 1.1.x) is
+ made available subject to the terms and conditions in CNRI's License
+ Agreement. This Agreement may be located on the Internet using the
+ following unique, persistent identifier (known as a handle):
+ 1895.22/1006. The License may also be obtained from a proxy server on
+ the Web using the following URL: http://hdl.handle.net/1895.22/1006."
+
+ 3. In the event Licensee prepares a derivative work that is based on or
+ incorporates the Software or any part thereof, and wants to make the
+ derivative work available to the public as provided herein, then
+ Licensee hereby agrees to indicate in any such work, in a prominently
+ visible way, the nature of the modifications made to CNRI's Software.
+
+ 4. Licensee may not use CNRI trademarks or trade name, including JPython
+ or CNRI, in a trademark sense to endorse or promote products or
+ services of Licensee, or any third party. Licensee may use the mark
+ JPython in connection with Licensee's derivative versions that are
+ based on or incorporate the Software, but only in the form
+ "JPython-based ___________________," or equivalent.
+
+ 5. CNRI is making the Software available to Licensee on an "AS IS" basis.
+ CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY
+ OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY
+ REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY
+ PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
+ ANY THIRD PARTY RIGHTS.
+
+ 6. CNRI SHALL NOT BE LIABLE TO LICENSEE OR OTHER USERS OF THE SOFTWARE FOR
+ ANY INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE
+ THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. SOME STATES DO NOT
+ ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY SO THE ABOVE DISCLAIMER
+ MAY NOT APPLY TO LICENSEE.
+
+ 7. This License Agreement may be terminated by CNRI (i) immediately upon
+ written notice from CNRI of any material breach by the Licensee, if the
+ nature of the breach is such that it cannot be promptly remedied; or
+ (ii) sixty (60) days following notice from CNRI to Licensee of a
+ material remediable breach, if Licensee has not remedied such breach
+ within that sixty-day period.
+
+ 8. This License Agreement shall be governed by and interpreted in all
+ respects by the law of the State of Virginia, excluding conflict of law
+ provisions. Nothing in this Agreement shall be deemed to create any
+ relationship of agency, partnership, or joint venture between CNRI and
+ Licensee.
+
+ 9. By clicking on the "ACCEPT" button where indicated, or by installing,
+ copying or otherwise using the Software, Licensee agrees to be bound by
+ the terms and conditions of this License Agreement.
+
+
+===============================================================================
+
+The jars; activation, jaxb-api, jaxb-impl, jsr173_api-1.0.jar, jsr181-api,
+jsr250, jaxws-api, mail, saaj-api, servlet-api-2.5.jar:
+
+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.
+
+===============================================================================
+
+JRuby, wsdl4j:
+
+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.
+
+===============================================================================
+
+backport-util-concurrent:
+
+The software comprising backport-util-concurrent is based in large
+part on the code from JSR166, and the package dl.util.concurrent.
+The software has been released to the public domain, as explained at:
+http://creativecommons.org/licenses/publicdomain, excepting portions
+of the class
+edu.emory.mathcs.backport.java.util.concurrent.CopyOnWriteArrayList,
+which were adapted from class java.util.ArrayList, written by Sun
+Microsystems, Inc, which are used with kind permission, and subject
+to the following:
+
+Copyright 2002-2004 Sun Microsystems, Inc. All rights reserved. Use is
+subject to the following license terms.
+
+ "Sun hereby grants you a non-exclusive, worldwide, non-transferrable
+ license to use and distribute the Java Software technologies as part
+ of a larger work in source and binary forms, with or without
+ modification, provided that the following conditions are met:
+
+ -Neither the name of or trademarks of Sun may be used to endorse or
+ promote products derived from the Java Software technology without
+ specific prior written permission.
+
+ -Redistributions of source or binary code must be accompanied by the
+ following notice and disclaimers:
+
+ Portions copyright Sun Microsystems, Inc. Used with kind permission.
+
+ This software is provided AS IS, without a warranty of any kind. ALL
+ EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PUPOSE OR
+ NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ MICROSYSTEMS, INC. AND ITS LICENSORS SHALL NOT BE LIABLE
+ FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
+ USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS
+ DERIVATIVES. IN NO EVENT WILL SUN MICROSYSTEMS, INC. OR
+ ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR
+ DATA, OR FOR DIRECT, INDIRECT,CONSQUENTIAL, INCIDENTAL
+ OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF
+ THE THEORY OR LIABILITY, ARISING OUT OF THE USE OF OR
+ INABILITY TO USE SOFTWARE, EVEN IF SUN MICROSYSTEMS, INC.
+ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+ You acknowledge that Software is not designed, licensed or intended for
+ use in the design, construction, operation or maintenance of any nuclear
+ facility."
+
+===============================================================================
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/NOTICE b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/NOTICE
new file mode 100644
index 0000000000..db953ef8c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/bin/NOTICE
@@ -0,0 +1,40 @@
+Apache Tuscany
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+=========================================================================
+== 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 at
+The Apache Software Foundation (http://www.apache.org/).
+
+"This product includes software developed by the Spring Framework
+ Project (http://www.springframework.org)."
+
+This product includes/uses the Jetty Servlet Engine (http://jetty.mortbay.org),
+developed by Mort Bay Consulting (http://www.mortbay.com)
+
+This product includes/uses the Groovy Script Engine (http://groovy.codehaus.org/),
+Copyright 2003 (C) James Strachan and Bob Mcwhirter. All Rights Reserved.
+
+This product includes/uses the Jaxen XPATH engine (http://jaxen.org/)
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+This product includes/uses software, AOP alliance (http://aopalliance.sourceforge.net)
+License: Public Domain
+
+This product includes/uses JSON-RPC-Java (http://oss.metaparadigm.com/jsonrpc/)
+
+This product includes software from the GlassFish project (https://glassfish.dev.java.net/)
+ Copyright (c) 2006, Sun Microsystems, Inc.
+
+This product also includes software developed by:
+- the Eclipse Modeling Framework project (http://www.eclipse.org/emf/)
+- the Mozilla Rhino project (http://www.mozilla.org/rhino/)
+
+Please see the LICENSE file present in the root directory of this
+distribution.
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/BUILDING b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/BUILDING
new file mode 100644
index 0000000000..7d02d6e1aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/BUILDING
@@ -0,0 +1,48 @@
+Building the Apache Tuscany SCA 0.90 (incubating) June 2007 Release source distribution
+=======================================================================================
+
+Initial Setup
+-------------
+
+1) Install J2SE 5.0 SDK, which can be downloaded from
+ http://java.sun.com/j2se/1.5.0/download.jsp. Use version of 1.5.0_06 JDK.
+
+2) Make sure that your JAVA_HOME environment variable is set to the newly installed
+ JDK location, and that your PATH includes %JAVA_HOME%\bin (windows) or
+ $JAVA_HOME$/bin (unix).
+
+3) Install Maven 2.0.5, which can be downloaded from
+ http://maven.apache.org/download.html. Make sure that your PATH includes
+ the MVN_HOME/bin directory.
+
+
+Building
+--------
+
+1) Change to the top level directory of Apache Tuscany source distribution.
+2) Run
+
+ $> mvn
+
+ This will compile Apache Tuscany and run all of the tests in the source
+ distribution.
+
+ Depending on the load of remote Maven 2.0 repositories, you may have
+ to run "mvn" several times utill the required dependencies are
+ all located in your local maven repository. It usually takes some time for
+ maven to download required dependencies in the first build. Once all the
+ dependencies have been downloaded you may use the -o option to run maven
+ in offline mode, for example, 'mvn clean install -o'.
+
+
+Building the distributions
+--------------------------
+
+1) Change to the distributions folder
+2) Run
+
+ $> mvn
+
+ This will build the binary and source distribution with .zip and .gz
+ formats in the distribution/target directory.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/LICENSE b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/LICENSE
new file mode 100644
index 0000000000..1f6ff4894f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/LICENSE
@@ -0,0 +1,285 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+===============================================================================================================
+
+The module itest/databindings/common includes the test schema; datagraph.xsd, sdoJava.xsd, and sdoModel.xsd
+under the following license:
+
+License for the Service Data Objects JavaDoc and Interface Definition files. (sdo-api-r2.0.1-1.0-incubator-M2.jar)
+
+Permission to copy, make derivative works of, and distribute the Service Data Objects
+JavaDoc and Interface Definition Files files in any medium without fee or royalty as part
+of a compliant implementation of the Service Data Objects Specification is hereby granted.
+The Service Data Objects Specification may be found at any of the following locations:
+
+http://dev2dev.bea.com/technologies/commonj/index.jsp
+http://www.ibm.com/developerworks/library/specification/ws-sdo/
+http://oracle.com/technology/webservices/sca
+https://www.sdn.sap.com/
+http://www.xcalia/xdn/specs/sdo
+
+THE SERVICE DATA OBJECTS SPECIFICATION AND THE JAVADOC AND INTERFACE DEFINITION FILES
+ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
+SPECIFICATION OR THE JAVADOC AND INTERFACE DEFINITION FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
+INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
+NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
+INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
+SERVICE DATA OBJECTS SPECIFICATION OR THE JAVADOC OR INTERFACE DEFINTION FILES.
+
+The name and trademarks of the Authors may NOT be used in any manner, including advertising or
+publicity pertaining to the Service Component Architecture Specification or its contents without specific,
+written prior permission. Title to copyright in the Service Data Objects Specification and the
+JavaDoc and Interface Definition Files will at all times remain with the Authors.
+
+No other rights are granted by implication, estoppel or otherwise.
+
+=================================================================================================================
+
+The module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, 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:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS 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
+ COPYRIGHT OWNER OR 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.
+
+=================================================================================================================
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/NOTICE b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/NOTICE
new file mode 100644
index 0000000000..206e2e5a1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/release/src/NOTICE
@@ -0,0 +1,33 @@
+Apache Tuscany
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+=========================================================================
+== 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 at
+The Apache Software Foundation (http://www.apache.org/).
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+ Copyright (c) 2006, Sun Microsystems, Inc.
+ All rights reserved.
+
+This product also includes software under the OSOA license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+ (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ 2005, 2006. All rights reserved.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/xsl/srcbuild_paths.xsl b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/xsl/srcbuild_paths.xsl
new file mode 100644
index 0000000000..ab7a40b94a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/distribution/src/main/xsl/srcbuild_paths.xsl
@@ -0,0 +1,56 @@
+<?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.
+-->
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+ xmlns:xalan="http://xml.apache.org/xslt">
+
+ <xsl:output method="xml" indent="yes" xalan:indent-amount="4"/>
+ <xsl:strip-space elements="*"/>
+
+ <!-- copy attributes from any node -->
+ <xsl:template match="@*" mode="attribute_copy">
+ <xsl:attribute name="{name(.)}">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template match="path">
+ <project name="source-build-paths">
+ <property>
+ <xsl:attribute name="file">${user.home}/.m2/maven.properties</xsl:attribute>
+ </property>
+ <property name="maven.repo.local">
+ <xsl:attribute name="value">${user.home}/.m2/repository</xsl:attribute>
+ </property>
+ <path id="srcbuild.classpath.path">
+ <xsl:copy-of select="*"/>
+ </path>
+ <property name="srcbuild.classpath" refid="srcbuild.classpath.path"/>
+ <property name="tuscany.lib.dir">
+ <xsl:attribute name="location">${user.home}/.m2/repository</xsl:attribute>
+ </property>
+
+ </project>
+ </xsl:template>
+
+ <xsl:template match="echo">
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/pom.xml
new file mode 100644
index 0000000000..a396285f07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-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>tuscany-itest-bindings-bindingscomposite</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingsutility</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..44801846f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/bindingsclient.composite
new file mode 100644
index 0000000000..ca3ff6494e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..22d7070ec3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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:8080/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/SCATestTool.jsp
new file mode 100644
index 0000000000..eb219e4cef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..fd58cb8b0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTest.java
new file mode 100644
index 0000000000..8467074c26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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", 8080);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/itest/WSBindingsClientTestCase.java
new file mode 100644
index 0000000000..b5f076b7e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsclient/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTest.java
new file mode 100644
index 0000000000..0f6cb912a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/pom.xml
new file mode 100644
index 0000000000..ceb96ac6d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingscomposite</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Service Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-beta1</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-beta1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelper.java
new file mode 100644
index 0000000000..efe30c4f4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCADataTypeHelperException.java
new file mode 100644
index 0000000000..074fba8057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..c55e22c905
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServer.java
new file mode 100644
index 0000000000..44e799a566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolService.java
new file mode 100644
index 0000000000..67b7e8eb64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/itest/SCATestToolServiceImpl.java
new file mode 100644
index 0000000000..e207a23927
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite-system.composite
new file mode 100644
index 0000000000..c288471c14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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">8080</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/bindingscomposite.composite
new file mode 100644
index 0000000000..33f9f713c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testtool.wsdl
new file mode 100644
index 0000000000..729593518d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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:8080/services/SCATestToolWSService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingscomposite/src/test/java/org/apache/tuscany/sca/itest/SCATestToolServerTestCase.java
new file mode 100644
index 0000000000..f6fe13c112
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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", 8080);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/pom.xml
new file mode 100644
index 0000000000..febfcf52cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing.bindingstest</groupId>
+ <artifactId>tuscany-itest-bindings-bindingsutility</artifactId>
+ <packaging>jar</packaging>
+ <name>SCA FVT Bindings Test Tool Utility Composite</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commonj</groupId>
+ <artifactId>sdo-api-r2.1</artifactId>
+ <version>1.0-incubating-beta1</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-beta1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/itest/SCATestToolCallbackService.java
new file mode 100644
index 0000000000..664fb06930
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServer.java
new file mode 100644
index 0000000000..cd967e275a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityService.java
new file mode 100644
index 0000000000..0ceb553727
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/java/org/apache/tuscany/sca/util/SCATestUtilityServiceImpl.java
new file mode 100644
index 0000000000..e752e4d6e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility-system.composite
new file mode 100644
index 0000000000..7126b78572
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/bindingsutility.composite
new file mode 100644
index 0000000000..6771b72442
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/main/resources/wsdl/testutility.wsdl
new file mode 100644
index 0000000000..32d9050a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/bindingsutility/src/test/java/org/apache/tuscany/sca/util/SCATestUtilityServerTestCase.java
new file mode 100644
index 0000000000..66246fc006
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/bindings/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/pom.xml
new file mode 100644
index 0000000000..8289ede113
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/bindings/pom.xml
@@ -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.
+-->
+<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.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <version>${testing.version}</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/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/pom.xml
new file mode 100644
index 0000000000..92da2ac39c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-api</artifactId>
+ <name>Apache Tuscany SCA Callback API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.java
new file mode 100644
index 0000000000..56e7ba7b3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiCallBack.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.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackApiCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.java
new file mode 100644
index 0000000000..3e7c840e15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackApiClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.java
new file mode 100644
index 0000000000..1c32783271
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackApiClient.class)
+public class CallBackApiClientImpl implements CallBackApiClient, CallBackApiCallBack {
+
+ @Reference
+ protected CallBackApiService aCallBackService;
+
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public void run() {
+
+ // This tests basic callback patterns.
+
+ // Test3a is the basic callback where the target calls back prior to
+ // returning to the client.
+ test3a();
+
+ // Test3b is where the target does not call back to the client.
+ test3b();
+
+ // Test3c is where the target calls back multiple times to the client.
+ test3c();
+
+ return;
+ }
+
+ private void test3a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackApiITest - test3a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test3b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackApiITest - test3b", 1, 1);
+ return;
+ }
+
+ private void test3c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackApiITest - test3c", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.java
new file mode 100644
index 0000000000..51d9f24723
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiService.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.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackApiCallBack.class)
+/**
+ *
+ */
+public interface CallBackApiService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.java
new file mode 100644
index 0000000000..727047e42e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/java/org/apache/tuscany/sca/test/CallBackApiServiceImpl.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;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackApiService.class)
+public class CallBackApiServiceImpl implements CallBackApiService {
+
+ @Context
+ protected ComponentContext componentContext;
+
+ private CallBackApiCallBack callback;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callback = this.getCallBackInterface();
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ callback = this.getCallBackInterface();
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackApiServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackApiServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackApiServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackApiServiceImpl message received: " + aString);
+
+ return;
+
+ }
+
+ private CallBackApiCallBack getCallBackInterface() {
+ System.out.println("CallBackApiServiceImpl getting request context");
+ RequestContext rc = componentContext.getRequestContext();
+ System.out.println("CallBackApiServiceImpl getting callback from request context");
+ callback = (CallBackApiCallBack) ((ServiceReference) rc.getServiceReference()).getCallback();
+ System.out.println("CallBackApiServiceImpl returning callback");
+ return callback;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/resources/CallBackApiTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/resources/CallBackApiTest.composite
new file mode 100644
index 0000000000..946c4862ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/main/resources/CallBackApiTest.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://callback"
+ name="CallBackApiTest">
+
+ <component name="CallBackApiClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiClientImpl"/>
+ <reference name="aCallBackService" target="CallBackApiService"/>
+ </component>
+
+ <component name="CallBackApiService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackApiServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.java
new file mode 100644
index 0000000000..892c425e48
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-api/src/test/java/org/apache/tuscany/sca/test/CallBackApiTest.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;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackApiTest extends TestCase {
+
+ private SCADomain domain;
+ private CallBackApiClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackApiTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackApiClient.class, "CallBackApiClient");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/pom.xml
new file mode 100644
index 0000000000..9cc75e2b44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-basic</artifactId>
+ <name>Apache Tuscany SCA Callback Basic Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.java
new file mode 100644
index 0000000000..ab1f39c057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicCallBack.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.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackBasicCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.java
new file mode 100644
index 0000000000..9f4019f28c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackBasicClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.java
new file mode 100644
index 0000000000..1bb2dc22b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackBasicClient.class)
+public class CallBackBasicClientImpl implements CallBackBasicClient, CallBackBasicCallBack {
+
+ @Reference
+ protected CallBackBasicService aCallBackService;
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public void run() {
+
+ // This tests basic callback patterns.
+
+ // Test1 is the basic callback where the target calls back prior to
+ // returning to the client.
+ test1a();
+
+ // Test2 is where the target does not call back to the client.
+ test1b();
+
+ // Test3 is where the target calls back multiple times to the client.
+ test1c();
+
+ return;
+ }
+
+ private void test1a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test1a", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test1b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackBasicITest - test1b", 1, 1);
+
+ return;
+ }
+
+ private void test1c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test1c", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.java
new file mode 100644
index 0000000000..bd41fa7037
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicService.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.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackBasicCallBack.class)
+/**
+ *
+ */
+public interface CallBackBasicService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.java
new file mode 100644
index 0000000000..4ca2dc9af9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/java/org/apache/tuscany/sca/test/CallBackBasicServiceImpl.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 org.apache.tuscany.sca.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackBasicService.class)
+public class CallBackBasicServiceImpl implements CallBackBasicService {
+
+ @Callback
+ protected CallBackBasicCallBack callback;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ // System.out.println("CallBackBasicServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/resources/CallBackBasicTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/resources/CallBackBasicTest.composite
new file mode 100644
index 0000000000..c506956088
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/main/resources/CallBackBasicTest.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://callback"
+ name="CallBackBasicTest">
+
+ <component name="CallBackBasicClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicClientImpl"/>
+ <reference name="aCallBackService" target="CallBackBasicService"/>
+ </component>
+
+ <component name="CallBackBasicService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackBasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.java
new file mode 100644
index 0000000000..c01d3d3e2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-basic/src/test/java/org/apache/tuscany/sca/test/CallBackBasicTestCase.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.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackBasicTestCase extends TestCase {
+
+ private SCADomain domain;
+ private CallBackBasicClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackBasicTest.composite");
+ aCallBackClient = domain.getService(CallBackBasicClient.class, "CallBackBasicClient");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/pom.xml
new file mode 100644
index 0000000000..010194364b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-complex-type</artifactId>
+ <name>Apache Tuscany SCA Callback Complex Type Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.java
new file mode 100644
index 0000000000..70e22f4ef2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeCallBack.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.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackCTypeCallBack {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.java
new file mode 100644
index 0000000000..739983c277
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackCTypeClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.java
new file mode 100644
index 0000000000..188b1f2c01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeClientImpl.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.sca.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackCTypeClient.class)
+public class CallBackCTypeClientImpl implements CallBackCTypeClient, CallBackCTypeCallBack {
+
+ @Reference
+ protected CallBackCTypeService aCallBackService;
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+ private static Object monitor = new Object();
+
+ public CallBackCTypeClientImpl() {
+ }
+
+ public void run() {
+
+ // This test is the same as the Basic Callback except it uses a
+ // componentType side file.
+ // This test currently fails because the integration test environment
+ // does not properly copy
+ // the componentType files to the target folder. This is documented in
+ // Tuscany-967.
+
+ // Test12a is the basic callback where the target calls back prior to
+ // returning to the client.
+ test12a();
+
+ // Test12b is where the target does not call back to the client.
+ test12b();
+
+ // Test12c is where the target calls back multiple times to the client.
+ test12c();
+
+ return;
+ }
+
+ private void test12a() {
+ aCallBackService.knockKnock("Knock Knock");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test12a -", "Who's There", this.getReturnMessage());
+
+ }
+
+ private void test12b() {
+ aCallBackService.noCallBack("No Reply Desired");
+ Assert.assertEquals("CallBackBasicITest - test12b -", 1, 1);
+ return;
+ }
+
+ private void test12c() {
+ aCallBackService.multiCallBack("Call me back 3 times");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (this.getCallBackCount() < 3 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackBasicITest - test12c -", 3, this.getCallBackCount());
+ return;
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+ System.out.println("Entering callback callBackMessage: " + aString);
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ monitor.notify();
+ }
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.java
new file mode 100644
index 0000000000..ffbf4f35fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeService.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.test;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+// @Callback(CallBackCTypeCallBack.class)
+/**
+ *
+ */
+public interface CallBackCTypeService {
+
+ public void knockKnock(String aString);
+
+ public void noCallBack(String aString);
+
+ public void multiCallBack(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.java
new file mode 100644
index 0000000000..dc31ed156b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/java/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.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.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackCTypeService.class)
+public class CallBackCTypeServiceImpl implements CallBackCTypeService {
+
+ @Callback
+ protected CallBackCTypeCallBack callback;
+
+ public CallBackCTypeServiceImpl() {
+ }
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ return;
+
+ }
+
+ public void multiCallBack(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ callback.callBackIncrement("Who's There 1");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ callback.callBackIncrement("Who's There 2");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ callback.callBackIncrement("Who's There 3");
+ System.out.println("CallBackCTypeServiceImpl response sent");
+ return;
+
+ }
+
+ public void noCallBack(String aString) {
+
+ System.out.println("CallBackCTypeServiceImpl message received: " + aString);
+ System.out.println("CallBackCTypeServiceImpl No response desired");
+ return;
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.composite
new file mode 100644
index 0000000000..3f48f16389
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/CallBackCTypeClient.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://callback"
+ name="CallBackCTypeTest">
+
+ <component name="CallBackCTypeClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeClientImpl"/>
+ <reference name="aCallBackService" target="CallBackCTypeService"/>
+ </component>
+
+ <component name="CallBackCTypeService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackCTypeServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.componentType
new file mode 100644
index 0000000000..ff38134df5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/main/resources/org/apache/tuscany/sca/test/CallBackCTypeServiceImpl.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" >
+
+ <service name="CallBackCTypeService">
+ <interface.java interface="org.apache.tuscany.sca.test.CallBackCTypeService"
+ callbackInterface="org.apache.tuscany.sca.test.CallBackCTypeCallBack"/>
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.java
new file mode 100644
index 0000000000..5ea13b8981
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-complex-type/src/test/java/org/apache/tuscany/sca/test/CallBackCTypeTest.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;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackCTypeTest extends TestCase {
+
+ private SCADomain domain;
+ private CallBackCTypeClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackCTypeClient.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackCTypeClient.class, "CallBackCTypeClient");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/pom.xml
new file mode 100644
index 0000000000..c1eabad457
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-id</artifactId>
+ <name>Apache Tuscany SCA Callback ID Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.java
new file mode 100644
index 0000000000..e86c7e9ed7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdCallBack.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.Remotable;
+
+@Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackIdCallBack {
+
+ public void callBackMessage(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.java
new file mode 100644
index 0000000000..a9e551f8b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackIdClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.java
new file mode 100644
index 0000000000..5adf64f0c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdClientImpl.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.test;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackIdClient.class)
+public class CallBackIdClientImpl implements CallBackIdClient, CallBackIdCallBack {
+
+ @Context
+ protected ComponentContext componentContext;
+ @Reference
+ protected CallBackIdService aCallBackService;
+
+ private static String returnMessage = null;
+ private static Object monitor = new Object();
+ private static Object callBackId;
+
+ public void run() {
+
+ // This tests the use of the set/get callbackId API both SCA generated
+ // and client specified.
+
+ // Test1 uses a SCA generated callback ID and compare that with the
+ // callbackID returned during callback.
+ test11a();
+
+ // Test2 uses a Client specified callback ID and compare that with the
+ // callbackID returned during callback.
+ test11b();
+
+ return;
+ }
+
+ private void test11a() {
+
+ // Retrieve this services callback ID and save it. Once the callback is
+ // received the callback ID will be compared with the one
+ // returned. Equal is good.
+
+ Object origCallBackId = ((ServiceReference)aCallBackService).getCallbackID();
+ aCallBackService.knockKnock("Knock Knock - Test1");
+ int count = 0;
+
+ //
+ // If we cannot get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackIdITest - test11a - SCA Generated Id", origCallBackId, this.getCallBackId());
+
+ }
+
+ private void test11b() {
+
+ // Set the services callback ID and save it. Once the callback is
+ // received the callback ID will be compared with the one
+ // returned. Equal is good.
+
+ String origCallBackId = "CallBackId1";
+ ((ServiceReference)aCallBackService).setCallbackID(origCallBackId);
+
+ aCallBackService.knockKnock("Knock Knock - Test2");
+ int count = 0;
+
+ //
+ // If we cant get a response in 30 seconds consider this a failure
+ //
+
+ synchronized (monitor) {
+ while (returnMessage == null && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert
+ .assertEquals("CallBackIdITest - 11b - Client Specified Id", origCallBackId, (String)this.getCallBackId());
+
+ }
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering callback callBackMessage: " + aString);
+ RequestContext rc = componentContext.getRequestContext();
+ Object callBackId = rc.getServiceReference().getCallbackID();
+
+ synchronized (monitor) {
+ this.setReturnMessage(aString);
+ this.setCallBackId(callBackId);
+ monitor.notify();
+ }
+ }
+
+ protected Object getCallBackId() {
+ return callBackId;
+ }
+
+ protected void setCallBackId(Object aCallBackId) {
+ callBackId = aCallBackId;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.java
new file mode 100644
index 0000000000..18c592a1c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdService.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.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(CallBackIdCallBack.class)
+/**
+ *
+ */
+public interface CallBackIdService {
+
+ public void knockKnock(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.java
new file mode 100644
index 0000000000..16f5ec3e11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/java/org/apache/tuscany/sca/test/CallBackIdServiceImpl.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;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackIdService.class)
+public class CallBackIdServiceImpl implements CallBackIdService {
+
+ @Callback
+ protected CallBackIdCallBack callback;
+ @Context
+ protected ComponentContext compositeContext;
+
+ public void knockKnock(String aString) {
+
+ System.out.println("CallBackIdServiceImpl message received: " + aString);
+ RequestContext rc = compositeContext.getRequestContext();
+ Object callBackId = rc.getServiceReference().getCallbackID();
+ System.out.println("CallBackIdServiceImpl callbackID: " + callBackId.toString());
+
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackIdServiceImpl response sent");
+ return;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/resources/CallBackIdClient.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/resources/CallBackIdClient.composite
new file mode 100644
index 0000000000..c9a6ba6258
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/main/resources/CallBackIdClient.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://callback"
+ name="CallBackIdTest">
+
+ <component name="CallBackIdClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdClientImpl"/>
+ <reference name="aCallBackService" target="CallBackIdService"/>
+ </component>
+
+ <component name="CallBackIdService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackIdServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.java
new file mode 100644
index 0000000000..a86fbc9a45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-id/src/test/java/org/apache/tuscany/sca/test/CallBackIdTest.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 junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackIdTest extends TestCase {
+
+ private SCADomain domain;
+ private CallBackIdClient aCallBackClient;
+
+ public void testCallBackBasic() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackIdClient.composite");
+
+ aCallBackClient = domain.getService(CallBackIdClient.class, "CallBackIdClient");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/pom.xml
new file mode 100644
index 0000000000..6226917bd6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-set-callback</artifactId>
+ <name>Apache Tuscany SCA Set Callback Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.java
new file mode 100644
index 0000000000..b352a2f1f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCalbackService.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.Callback;
+
+// @Remotable
+@Callback(CallBackSetCallbackCallback.class)
+/**
+ *
+ */
+public interface CallBackSetCalbackService {
+
+ public void knockKnock(String aString);
+
+ public void setCallbackIllegally(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.java
new file mode 100644
index 0000000000..766d47c654
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackBadCallback.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.sca.test;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackBadCallback {
+
+ private String anAttribure = null;
+ private int anIntAttribute = 0;
+
+ public CallBackSetCallbackBadCallback() {
+ super();
+ }
+
+ public void callback(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("CallBackSetCallbackBadCallback: callback called");
+ Assert.fail("CallBackSetCallbackBadCallback: callback called");
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.java
new file mode 100644
index 0000000000..26a6ecc879
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallback.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;
+
+// @Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackSetCallbackCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.java
new file mode 100644
index 0000000000..0a22b0e01f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackCallbackImpl.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.sca.test;
+
+import java.io.File;
+
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackCallback.class)
+public class CallBackSetCallbackCallbackImpl implements CallBackSetCallbackCallback {
+
+ private static String returnMessage = null;
+ private static int callBackCount = 0;
+
+ public String getReturnMessage() {
+ return returnMessage;
+ }
+
+ public void setReturnMessage(String aReturnMessage) {
+ returnMessage = aReturnMessage;
+ }
+
+ public int getCallBackCount() {
+ return callBackCount;
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackCallbackImpl callBackMessage: " + aString);
+
+ File aFile = new File("target/test4_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test4_marker marker file");
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ this.incrementCallBackCount();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.java
new file mode 100644
index 0000000000..94cb6aa73b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackSetCallbackClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.java
new file mode 100644
index 0000000000..9fafb05835
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackClientImpl.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.sca.test;
+
+import java.io.File;
+
+import junit.framework.Assert;
+
+import org.osoa.sca.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackClient.class)
+public class CallBackSetCallbackClientImpl implements CallBackSetCallbackClient {
+
+ @Reference
+ protected CallBackSetCalbackService aCallBackService;
+ @Reference
+ protected CallBackSetCallbackCallback callBack;
+
+ public void run() {
+
+ // This test various aspects of the setCallback() API in a stateless
+ // scope.
+
+ /*
+ * test4 Client does not implement the callback interface but calls
+ * setCallback with a service reference before invoking the target,
+ * Verify successful executon.
+ */
+
+ test4();
+
+ /*
+ * test5 The client does not implement the callback interface and does
+ * not call setCallback() before invoking the target. Verify a
+ * NoRegisteredCallbackException is thrown.
+ */
+
+ test5();
+
+ /*
+ * test6() The client calls setCallback() with an object that is not a
+ * service reference and the callback interface is stateless. Verify
+ * that an appropriate exception is thrown. When calling setCallback
+ * with an object the interface must be stateful. Stateless interfaces
+ * require a service Reference.
+ */
+
+ test6();
+
+ /*
+ * test10 The target calls setCallback() on its own service reference,
+ * e.g. getRequestContext().getServiceReference().getCallback(). Verify
+ * an appropriate exeception occurs.
+ */
+
+ test10();
+
+ return;
+ }
+
+ private void test4() {
+
+ //
+ // Since callbacks do not synchronously return and this test results in
+ // a callback to a component other
+ // than this client I am using a marker file to determine the outcome.
+ // The presence of the marker
+ // file will be used for the Assertion test. If it exists then the
+ // callback occurred and all is good.
+ //
+
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File("target/test4_marker");
+ if (aFile.exists())
+ aFile.delete();
+
+ ((ServiceReference)aCallBackService).setCallback(callBack);
+
+ aCallBackService.knockKnock("Knock Knock");
+
+ // Lets give the callback a little time to complete....
+
+ int count = 0;
+ long timeout = 1000;
+
+ while (count++ < 30 && (aFile.exists() == false)) {
+ try {
+ Thread.sleep(timeout);
+ } catch (InterruptedException ie) {
+ }
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test4", true, aFile.exists());
+
+ }
+
+ private void test5() {
+
+ boolean correctException = false;
+
+ //
+ // The backend service is expecting a callback reference to be set. This
+ // test will not
+ // set one so an exception is expected. According to the spec if a
+ // client calls a method on
+ // a service reference prior to calling setCallback() then a
+ // NoRegisteredCallbackException
+ // will be thrown on the client.
+ //
+
+ try {
+ aCallBackService.knockKnock("Knock Knock");
+ } catch (NoRegisteredCallbackException NotRegEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test5", true, correctException);
+
+ }
+
+ private void test6() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does impliment
+ // the callback interface. However because this callback service is
+ // stateless the expected
+ // result is an appropriate exception.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackObjectCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (NoRegisteredCallbackException NotRegEx) {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallback - Test6", true, correctException);
+
+ }
+
+ private void test10() {
+ //
+ // Since callbacks do not synchronously return and this test results in
+ // a failure on the service
+ // side of the fence I am using a marker file to determine the outcome.
+ // The presence of the marker
+ // file will be used for the Assertion test. If it exists then all is
+ // good.
+ //
+
+ // Make sure the marker file is not present before starting the test.
+ File aFile = new File("target/test10_marker");
+ if (aFile.exists())
+ aFile.delete();
+
+ aCallBackService.setCallbackIllegally("Try to set callback on your own service reference");
+
+ Assert.assertEquals("CallBackSetCallback - Test10", true, aFile.exists());
+
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.java
new file mode 100644
index 0000000000..afedcdf7f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackObjectCallback.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.sca.test;
+
+public class CallBackSetCallbackObjectCallback implements CallBackSetCallbackCallback {
+
+ private int callBackCount = 0;
+
+ public CallBackSetCallbackObjectCallback() {
+ super();
+ }
+
+ public void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+ System.out.println("Entering callback increment: " + aString);
+ this.incrementCallBackCount();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java
new file mode 100644
index 0000000000..0eccf6e379
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackServiceImpl.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCalbackService.class)
+public class CallBackSetCallbackServiceImpl implements CallBackSetCalbackService {
+
+ @Callback
+ private CallBackSetCallbackCallback callback;
+ @Context
+ private ComponentContext context;
+
+ public void knockKnock(String aString) {
+
+ try {
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ // Context is not working properly so we can't trust that this is
+ // working.....
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ } catch (Exception ex) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + ex.toString());
+ ex.printStackTrace();
+ return;
+ }
+
+ // Ok, call setCallback with my own service reference.
+ try {
+ serviceRef.setCallback(serviceRef);
+ } catch (NullPointerException npe) // This needs to be removed once
+ // appropriate exception is
+ // identified.
+ {
+ // This is not an appropriate exception.
+ System.out.println("Test10 NPE exception during setCallback to own service reference");
+ npe.printStackTrace();
+ return;
+ }
+ // This needs to catch the appropriate exception, once we figure out
+ // what is needs to be!
+ catch (Exception ex) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ }
+ ;
+
+ // If we get the exception we are looking for then create the marker
+ // file.
+ if (exceptionProduced == true) {
+ File aFile = new File("target/test10_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test10_marker marker file");
+ ex.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite
new file mode 100644
index 0000000000..3552ddecab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/main/resources/CallBackSetCallbackTest.composite
@@ -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"
+ targetNamespace="http://callback"
+ name="CallBackSetCallbackTest">
+
+ <component name="CallBackSetCallbackClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackClientImpl"/>
+ <reference name="aCallBackService" target="CallBackSetCallbackService"/>
+ <reference name="callBack" target="CallBackSetCallbackCallback"/>
+ </component>
+
+ <component name="CallBackSetCallbackCallback">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackCallbackImpl"/>
+ </component>
+
+ <component name="CallBackSetCallbackService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.java
new file mode 100644
index 0000000000..f977dd643f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-callback/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackTest.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.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackSetCallbackTest extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackClient.class,
+ "CallBackSetCallbackClient");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/pom.xml
new file mode 100644
index 0000000000..3a88495594
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-callback-set-conversation</artifactId>
+ <name>Apache Tuscany SCA Callback Set Conversation Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.java
new file mode 100644
index 0000000000..685dd83c62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvBadCallback.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.test;
+
+import java.io.Serializable;
+
+import junit.framework.Assert;
+
+public class CallBackSetCallbackConvBadCallback implements Serializable {
+
+ public CallBackSetCallbackConvBadCallback() {
+ super();
+ }
+
+ public void callback(String aString) {
+ //
+ // This callback method should never be called.
+ //
+ System.out.println("CallBackSetCallbackBadCallback: callback called");
+ Assert.fail("CallBackSetCallbackConvBadCallback: callback called");
+ return;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.java
new file mode 100644
index 0000000000..7483e834b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvCallback.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;
+
+// @Remotable
+/**
+ * @author lamodeo
+ */
+public interface CallBackSetCallbackConvCallback {
+
+ public void callBackMessage(String aString);
+
+ public void callBackIncrement(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.java
new file mode 100644
index 0000000000..013424bf5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface CallBackSetCallbackConvClient {
+
+ public void run();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
new file mode 100644
index 0000000000..ef9d858126
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvClientImpl.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.NoRegisteredCallbackException;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+@Service(CallBackSetCallbackConvClient.class)
+@Scope("CONVERSATION")
+public class CallBackSetCallbackConvClientImpl implements CallBackSetCallbackConvClient {
+
+ @Reference
+ protected CallBackSetCallbackConvService aCallBackService;
+ private CallBackSetCallbackConvObjectCallback aCallbackObject = null;
+ private Object monitor = new Object();
+
+ public void run() {
+
+ // This tests aspects of the setCallback() API within a conversational
+ // scope.
+
+ /*
+ * test7 The client calls setCallback() with an object that is not a
+ * service reference and the callback interface is stateful. Verify
+ * successful execution.
+ */
+ test7();
+
+ /*
+ * test8() The client calls setCallback() with an object that does not
+ * implement the callback interface. Verify an appropriate exception is
+ * thrown. This requires a STATEFUL interface.
+ */
+ test8();
+
+ /*
+ * test9 The client calls setCallback() with an object that is not
+ * serializable. Verify an appropriate exception is thrown. This
+ * requires a STATEFUL callback interface. Move from the stateless test
+ * case.
+ */
+ test9();
+
+ return;
+ }
+
+ private void test7() {
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does implement
+ // the callback interface and is Serializeable. Verify successful
+ // execution.
+ //
+
+ aCallbackObject = new CallBackSetCallbackConvObjectCallback();
+ aCallbackObject.incrementCallBackCount();
+ aCallbackObject.setMonitor(monitor);
+
+ ((ServiceReference)aCallBackService).setCallback(aCallbackObject);
+ aCallBackService.knockKnock("Knock Knock");
+
+ // Lets give the callback a little time to complete....
+
+ int count = 0;
+
+ synchronized (monitor) {
+ while (aCallbackObject.getCount() != 2 && count++ < 30) {
+ try {
+ monitor.wait(1000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test7", 2, aCallbackObject.getCount());
+
+ }
+
+ private void test8() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does not impliment
+ // the callback interface. The expected result is an appropriate
+ // exception.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvBadCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+
+ //
+ // This should catch an appropriate exception.
+ //
+
+ catch (NoRegisteredCallbackException NotRegEx) // This needs to be
+ // changed to proper
+ // exception once we
+ // know what it is ;-)
+ {
+ correctException = true;
+ }
+
+ catch (Exception ex) {
+ // This means an inappropriate exception occurred
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test8", true, correctException);
+
+ }
+
+ private void test9() {
+
+ boolean correctException = false;
+
+ //
+ // This test is to specify an Object that is not a service reference
+ // that does impliment
+ // the callback interface but does not implement Serializeable. Verify
+ // an appropriate exception
+ // is thrown.
+ //
+
+ try {
+ ((ServiceReference)aCallBackService).setCallback(new CallBackSetCallbackConvNonSerCallback());
+ aCallBackService.knockKnock("Knock Knock");
+ }
+ //
+ // This should catch an appropriate exception.
+ //
+ catch (NoRegisteredCallbackException NotRegEx) // This needs to be
+ // changed to
+ // appropriate exception
+ // when we know what it
+ // is ;-)
+ {
+ correctException = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ Assert.assertEquals("CallBackSetCallbackConv - Test9", true, correctException);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.java
new file mode 100644
index 0000000000..789e04e907
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvNonSerCallback.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.test;
+
+public class CallBackSetCallbackConvNonSerCallback implements CallBackSetCallbackConvCallback {
+
+ private int callBackCount = 0;
+ private Object monitor;
+
+ public CallBackSetCallbackConvNonSerCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return callBackCount;
+ }
+
+ public void setMonitor(Object anObject) {
+ monitor = anObject;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackConvNonSerCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+
+ System.out.println("Entering callback increment: " + aString);
+
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.java
new file mode 100644
index 0000000000..fead6705fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvObjectCallback.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;
+
+import java.io.Serializable;
+
+public class CallBackSetCallbackConvObjectCallback implements CallBackSetCallbackConvCallback, Serializable {
+
+ private int callBackCount = 0;
+ private Object monitor;
+
+ public CallBackSetCallbackConvObjectCallback() {
+ super();
+ }
+
+ public synchronized void incrementCallBackCount() {
+ callBackCount++;
+ }
+
+ public synchronized int getCount() {
+ return callBackCount;
+ }
+
+ public void setMonitor(Object anObject) {
+ monitor = anObject;
+ }
+
+ public void callBackMessage(String aString) {
+
+ System.out.println("Entering CallBackSetCallbackObjectCallback callBackMessage: " + aString);
+
+ }
+
+ public void callBackIncrement(String aString) {
+
+ System.out.println("Entering callback increment: " + aString);
+
+ synchronized (monitor) {
+ this.incrementCallBackCount();
+ monitor.notify();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.java
new file mode 100644
index 0000000000..4b0dccefdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvService.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.Callback;
+
+// @Remotable
+@Callback(CallBackSetCallbackConvCallback.class)
+/**
+ *
+ */
+public interface CallBackSetCallbackConvService {
+
+ public void knockKnock(String aString);
+
+ public void setCallbackIllegally(String aString);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.java
new file mode 100644
index 0000000000..5b685e695b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvServiceImpl.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.sca.test;
+
+import java.io.File;
+
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+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(CallBackSetCallbackConvService.class)
+@Scope("CONVERSATION")
+public class CallBackSetCallbackConvServiceImpl implements CallBackSetCallbackConvService {
+
+ @Callback
+ private CallBackSetCallbackConvCallback callback;
+ @Context
+ protected ComponentContext context;
+
+ public void knockKnock(String aString) {
+
+ try {
+ System.out.println("CallBackBasicServiceImpl message received: " + aString);
+ callback.callBackMessage("Who's There");
+ System.out.println("CallBackBasicServiceImpl response sent");
+ return;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ public void setCallbackIllegally(String aString) {
+
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() message received: " + aString);
+
+ boolean exceptionProduced = false;
+ RequestContext requestContext = null;
+ ServiceReference serviceRef = null;
+
+ // Context is not working properly so we can't trust that this is
+ // working.....
+ try {
+ requestContext = context.getRequestContext();
+ serviceRef = (ServiceReference) requestContext.getServiceReference();
+ } catch (Exception ex) {
+ System.out.println("CallBackBasicServiceImpl.setCallbackIllegally() " + ex.toString());
+ ex.printStackTrace();
+ return;
+ }
+
+ // Ok, call setCallback with my own service reference.
+ try {
+ serviceRef.setCallback(serviceRef);
+ } catch (NullPointerException npe) {
+ // This is not an appropriate exception.
+ System.out.println("Test10 NPE exception during setCallback to own service reference");
+ npe.printStackTrace();
+ return;
+ }
+ // This needs to catch the appropriate exception, once we figure out
+ // what is needs to be!
+ catch (Exception ex) {
+ exceptionProduced = true;
+ System.out.println("Test10 appropriate exception caught during setCallback to own service reference");
+ }
+ ;
+
+ // If we get the exception we are looking for then create the marker
+ // file.
+ if (exceptionProduced == true) {
+ File aFile = new File("target/test10_marker");
+ try {
+ aFile.createNewFile();
+ } catch (Exception ex) {
+ System.out.println("Error Creating target/test10_marker marker file");
+ ex.printStackTrace();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.composite
new file mode 100644
index 0000000000..ce73417f94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/main/resources/CallBackSetCallbackConvTest.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://callback"
+ name="CallBackSetCallbackConvTest">
+
+ <component name="CallBackSetCallbackConvClient">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvClientImpl"/>
+ <reference name="aCallBackService" target="CallBackSetCallbackConvService"/>
+ </component>
+
+
+ <component name="CallBackSetCallbackConvService">
+ <implementation.java class="org.apache.tuscany.sca.test.CallBackSetCallbackConvServiceImpl"/>
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.java
new file mode 100644
index 0000000000..e9113a8766
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/callback-set-conversation/src/test/java/org/apache/tuscany/sca/test/CallBackSetCallbackConvTest.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.test;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CallBackSetCallbackConvTest extends TestCase {
+
+ private SCADomain domain;
+ private CallBackSetCallbackConvClient aCallBackClient;
+
+ public void testCallBackSetCallback() {
+ aCallBackClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("CallBackSetCallbackConvTest.composite");
+
+ aCallBackClient =
+ domain.getService(CallBackSetCallbackConvClient.class,
+ "CallBackSetCallbackConvClient");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/pom.xml
new file mode 100644
index 0000000000..57359aa667
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-contribution</artifactId>
+ <name>Apache Tuscany Contribution Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..6392676e76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9c635e3c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..40ca4d9b0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorClient.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 org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain domain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService = domain.getService(CalculatorService.class,
+ "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ domain.close();
+
+ }
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..ad87375529
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ae4ed12b7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..3158458b5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..62db05175e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..309f88f098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1a7f145ad8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/ContributionTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/ContributionTest.composite
new file mode 100644
index 0000000000..d814e439e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/ContributionTest.composite
@@ -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"
+ xmlns:foo="http://foo"
+ name="ContributionTest">
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/Calculator.composite
new file mode 100644
index 0000000000..657a2f95d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/Calculator.composite
@@ -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"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"></reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </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/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/sca-contribution.xml b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/sca-contribution.xml
new file mode 100644
index 0000000000..2d31075091
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/main/resources/calculator/sca-contribution.xml
@@ -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.
+-->
+<contribution xmlns=http://www.osoa.org/xmlns/sca/1.0>
+ <deployable composite="Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
new file mode 100644
index 0000000000..0322796417
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/java/org/apache/tuscany/sca/test/contribution/ContributionServiceTestCase.java
@@ -0,0 +1,238 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+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.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * This is more intended to be a integration test then a unit test. *
+ */
+public class ContributionServiceTestCase extends TestCase {
+ private static final String CONTRIBUTION_001_ID = "contribution001/";
+ private static final String CONTRIBUTION_002_ID = "contribution002/";
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+ private static final String FOLDER_CONTRIBUTION = "target/classes/";
+
+ private ContributionService contributionService;
+
+ protected void setUp() throws Exception {
+
+ // Create default factories
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ // Create an extension point registry
+ ExtensionPointRegistry extensionRegistry = new DefaultExtensionPointRegistry();
+
+ // Add artifact processor extension points
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ extensionRegistry.addExtensionPoint(staxProcessors);
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ DefaultURLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
+ extensionRegistry.addExtensionPoint(documentProcessors);
+ ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Register base artifact processors
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(assemblyFactory, policyFactory, mapper,
+ staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory,
+ staxProcessor));
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+
+ // Create package processor extension point
+ PackageTypeDescriberImpl describer = new PackageTypeDescriberImpl();
+ PackageProcessorExtensionPoint packageProcessors = new DefaultPackageProcessorExtensionPoint();
+ PackageProcessor packageProcessor = new ExtensiblePackageProcessor(packageProcessors, describer);
+ extensionRegistry.addExtensionPoint(packageProcessors);
+
+ // Register base package processors
+ packageProcessors.addPackageProcessor(new JarContributionProcessor());
+ packageProcessors.addPackageProcessor(new FolderContributionProcessor());
+
+ // Create a repository
+ ContributionRepository repository = new ContributionRepositoryImpl("target");
+
+ // Create an artifact resolver and contribution service
+ this.contributionService = new ContributionServiceImpl(repository, packageProcessor, documentProcessor,
+ assemblyFactory,
+ new ContributionFactoryImpl(), XMLInputFactory
+ .newInstance());
+ }
+
+ public void testContributeJAR() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ public void testStoreContributionPackageInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, resolver, true);
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ public void testStoreContributionStreamInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+
+ InputStream contributionStream = contributionLocation.openStream();
+ try {
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, contributionLocation, contributionStream, resolver);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ }
+
+ assertTrue(FileHelper.toFile(new URL(contributionService.getContribution(contributionId).getLocation()))
+ .exists());
+
+ assertNotNull(contributionId);
+
+ Contribution contributionModel = contributionService.getContribution(contributionId);
+
+ File contributionFile = FileHelper.toFile(new URL(contributionModel.getLocation()));
+ assertTrue(contributionFile.exists());
+ }
+
+ public void testStoreDuplicatedContributionInRepository() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId1 = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId1, contributionLocation, resolver, true);
+ assertNotNull(contributionService.getContribution(contributionId1));
+ String contributionId2 = CONTRIBUTION_002_ID;
+ ModelResolver resolver2 = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId2, contributionLocation, resolver2, true);
+ assertNotNull(contributionService.getContribution(contributionId2));
+ }
+
+ public void testContributeFolder() throws Exception {
+ File rootContributionFolder = new File(FOLDER_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ //first rename the sca-contribution metadata file
+ //File calculatorMetadataFile = new File("target/classes/calculator/sca-contribution.xml");
+ //File metadataDirectory = new File("target/classes/META-INF/");
+ //if (!metadataDirectory.exists()) {
+ // FileHelper.forceMkdir(metadataDirectory);
+ //}
+ //FileHelper.copyFileToDirectory(calculatorMetadataFile, metadataDirectory);
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ contributionService.contribute(contributionId, rootContributionFolder.toURL(), resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+ }
+
+ public void testAddDeploymentComposites() throws Exception {
+ URL contributionLocation = getClass().getResource(JAR_CONTRIBUTION);
+ String contributionId = CONTRIBUTION_001_ID;
+ ModelResolver resolver = new ModelResolverImpl(getClass().getClassLoader());
+ Contribution contribution = contributionService.contribute(contributionId, contributionLocation, resolver, false);
+ assertNotNull(contributionService.getContribution(contributionId));
+
+ String artifactId = "contributionComposite.composite";
+ Composite composite = (new DefaultAssemblyFactory()).createComposite();
+ composite.setName(new QName(null, "contributionComposite"));
+ composite.setURI("contributionComposite.composite");
+
+ contributionService.addDeploymentComposite(contribution, composite);
+
+ List deployables = contributionService.getContribution(contributionId).getDeployables();
+ Composite composite1 = (Composite)deployables.get(deployables.size() - 1);
+ assertEquals("contributionComposite", composite1.getName().toString());
+
+ DeployedArtifact artifact = null;
+ contribution = contributionService.getContribution(contributionId);
+ String id = artifactId.toString();
+ for (DeployedArtifact a : contribution.getArtifacts()) {
+ if (id.equals(a.getURI())) {
+ artifact = a;
+ break;
+ }
+ }
+ Composite composite2 = (Composite)artifact.getModel();
+ assertEquals("contributionComposite", composite2.getName().toString());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/contribution/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/pom.xml
new file mode 100644
index 0000000000..a00b2c8ac3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-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>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.java
new file mode 100644
index 0000000000..31786588b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherService.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.test;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+
+/**
+ *
+ */
+public interface AnotherService {
+
+ public void setService(ServiceReference aServiceReference);
+ public void add(int anInt);
+ public int getCount();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/AnotherServiceImpl.java
new file mode 100644
index 0000000000..027109787a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.java
new file mode 100644
index 0000000000..5eb9ba3ace
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsCallback.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.sca.test;
+
+
+/**
+ * @author lamodeo
+ *
+ */
+public interface ConversationsCallback {
+
+ public void callBackMessage(String aString);
+ public void callBackIncrement(String aString);
+ public void callBackEndSession();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.java
new file mode 100644
index 0000000000..a23748bcd2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ConversationsClient {
+
+ public void run();
+ public int count();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.java
new file mode 100644
index 0000000000..41463fa39a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClient2.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;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface ConversationsClient2 {
+ public String getDateTime();
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
new file mode 100644
index 0000000000..00c2a1c2f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsClientImpl.java
@@ -0,0 +1,490 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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 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.
+ //
+ //FIXME Port to the 1.0 spec API
+ //Object aServicesSessionID =((ServiceReference)aService).getSessionID();
+ //Assert.assertNotNull("test0 - ConversationID from service reference", aServicesSessionID);
+
+ //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(20000L);
+ }
+ 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;
+ 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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.java
new file mode 100644
index 0000000000..bd18b48da2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleService.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.test;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+
+/**
+ *
+ */
+public interface ConversationsLifeCycleService {
+
+ public String knockKnock(String aString);
+ public void endThisSession();
+ public void endThisSessionUsingCallback();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsLifeCycleServiceImpl.java
new file mode 100644
index 0000000000..7f38e356f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.java
new file mode 100644
index 0000000000..6bdc1c5c03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsService.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.sca.test;
+
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@Callback(ConversationsCallback.class)
+
+/**
+ *
+ */
+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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/java/org/apache/tuscany/sca/test/ConversationsServiceImpl.java
new file mode 100644
index 0000000000..45fc68308b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/resources/ConversationsTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/main/resources/ConversationsTest.composite
new file mode 100644
index 0000000000..93b44c260f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.java
new file mode 100644
index 0000000000..af917d67f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/conversations/src/test/java/org/apache/tuscany/sca/test/ConversationsTest.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;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class ConversationsTest extends TestCase {
+
+ private SCADomain domain;
+ private ConversationsClient aConversationsClient;
+
+ public void testConversations() {
+ aConversationsClient.run();
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ConversationsTest.composite");
+
+ aConversationsClient =
+ domain.getService(ConversationsClient.class,
+ "ConversationsClient/org.apache.tuscany.sca.test.ConversationsClient");
+
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/pom.xml
new file mode 100644
index 0000000000..9551a637f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/pom.xml
@@ -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</groupId>
+ <artifactId>tuscany-itest-databindings</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Common elements of Databindings Integration Tests</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>1.4</version>
+ <scope>compile</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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${basedir}/src/main/resources/generate/generate.xsd</fileName>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.java
new file mode 100644
index 0000000000..73dfebb73c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/java/org/apache/tuscany/sca/itest/generate/Generate.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.sca.itest.generate;
+
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.tuscany.generate.GenerateFactory;
+import org.apache.tuscany.generate.GenerateType;
+import org.apache.tuscany.generate.TemplateType;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.Velocity;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * Generates test files based on the information in a configuration files (generate.xml)
+ * and a set of velocity templates. The process is
+ *
+ * for each template
+ * for each file
+ * add a line to pom for code gen
+ * include the factory into the composite
+ * for each type
+ * add client iface method
+ * add client impl method
+ * add service iface method
+ * add service impl method
+ * add test method
+ * add wsdl type and method
+ *
+ * @version $Rev$ $Date$
+ */
+public class Generate {
+
+ /**
+ * Does all the hard work of running the velocity templates against the
+ * the list of types to test. Both the list of templates and the list of
+ * XSD files is held in the configuration file (generate.xsd) which lives in the
+ * resources/generate directory of the project being generated.
+ *
+ * @param projectBuildDir the path to the target dir of the project being generated.
+ */
+ public static void generate(String projectBuildDir) {
+ System.out.println(">> Building project from dir: " + projectBuildDir);
+ FileInputStream fis = null;
+
+ try {
+ // Load the config file into a stream
+ fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml");
+
+ // Load the stream into SDO
+ // We are just using SDO as a conveniet way to parse the XML config file
+ HelperContext scope = SDOUtil.createHelperContext();
+ GenerateFactory.INSTANCE.register(scope);
+ XMLDocument xmlDoc = scope.getXMLHelper().load(fis);
+ GenerateType generateType = (GenerateType)xmlDoc.getRootObject();
+
+ // Get the file list. This is the list of XSD that is passed into the
+ // the velocity templates. Each confiured file holds a list of types
+ // that the velocity templates expand into appropriate methods and method calls
+ List fileList = generateType.getInputFile();
+
+ //Intialise velocity ready to generate the various files
+ Properties p = new Properties();
+ p.setProperty("file.resource.loader.path", projectBuildDir + "/classes/generate");
+ Velocity.init(p);
+ VelocityContext context = new VelocityContext();
+ context.put("fileList", fileList);
+
+ List templateList = generateType.getTemplate();
+
+ // For each velocity template in the template list pass in the XSD file list
+ for ( Object item: templateList){
+ TemplateType template = (TemplateType)item;
+ context.put("template", template);
+ String tmp = template.getTemplateName();
+ String filename = projectBuildDir + "/" + template.getTemplateTargetDir() + "/" + tmp.substring(0,tmp.length() - 3);
+ FileWriter fw = new FileWriter(filename);
+ System.out.println(">> Processing " + template.getTemplateName() + " to " + filename);
+ Velocity.mergeTemplate(template.getTemplateName(), context, fw );
+ fw.flush();
+ fw.close();
+ }
+
+ } catch (Exception e) {
+ System.out.println("Exception : " + e.toString());
+ e.printStackTrace();
+ return;
+ }
+ }
+
+ /**
+ * The mainline
+ *
+ * @param args the target directory where project in which files are being generated
+ */
+ public static void main(String[] args) {
+ Generate gen = new Generate();
+ gen.generate(args[0]);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
new file mode 100644
index 0000000000..b2346aa973
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/DatabindingTestCase.java.vm
@@ -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 $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+import ${template.getJavaPackage()}.GreeterService;
+
+// Data types
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+import $file.getJavaPackage().$file.getFactory();
+#end
+#end
+
+/**
+ * Automatically generated test case. Calls the greeter client for a number of
+ * bindings and a number of data types.
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+public class DatabindingTestCase extends TestCase {
+
+ private SCADomain domain;
+ private GreeterService greeterClient;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("greeter.composite");
+ super.setUp();
+ }
+
+ /**
+ * Runs after each test method
+ */
+ protected void tearDown() {
+ domain.close();
+ }
+
+ /**
+ * Finds the SCA component that relates to the protocol being tested. This test
+ * always connects locally to the client component but the client component will
+ * connect to the back end component using the appropriate protocol
+ *
+ * @param ext the protcol required
+ */
+ private void setUpClient(String ext) throws Exception {
+ greeterClient = domain.getService(GreeterService.class, ext + "GreeterServiceClient");
+ }
+
+ /**
+ * Invokes the SDO Greet service using web service bindings with SDO payload
+ */
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the SDO Greet service using default bindings with SDO payload
+ */
+ public void testDefaultGreet() throws Exception {
+ setUpClient("Default");
+ greet();
+ }
+
+ /**
+ * A generic method which, regarless of which client is connected, sends out a
+ * series of requrests passing different data types.
+ */
+ public void greet() {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ // test $typeInstance.getTypeName()
+ {
+ $typeInstance.getTypeName() param = null;
+ $typeInstance.getCreateTypeCode()
+ $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param);
+ $typeInstance.getResultComparison()
+ }
+#end
+#end
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
new file mode 100644
index 0000000000..f08d56c55a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/Greeter.wsdl.vm
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/GreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
new file mode 100644
index 0000000000..b0e298b823
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterService.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * The automcatically generated interface to the service that reflects data objects
+ * that are sent to it
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+@Remotable
+public interface GreeterService {
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ /**
+ * Take the provided data object, change it slightly and return it
+ *
+ * @param param the data object to be changed and returned
+ * @return the change data object
+ */
+ $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param);
+#end
+#end
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm
new file mode 100644
index 0000000000..ee73db6152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClient.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * GreeterServiceClient
+ */
+@AllowsPassByReference
+public interface GreeterServiceClient {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param);
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
new file mode 100644
index 0000000000..57827d27b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceClientImpl.java.vm
@@ -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 $template.getJavaPackage();
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+/**
+ * The automcatically generated service that simply forwards data objects on to
+ * the GreeterService and passes back the responses
+ *
+ * @version $Rev: 508831 $ $Date: 2007-02-18 00:12:31 +0000 (Sun, 18 Feb 2007) $
+ */
+@Service(GreeterService.class)
+public class GreeterServiceClientImpl implements GreeterService {
+
+ /**
+ * the reference the the GreeterService that will
+ * change each data object slightly and return it
+ */
+ private GreeterService service;
+
+ @Reference
+ public void setGreeterService(GreeterService service) {
+ this.service = service;
+ }
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.itest.sdodatabinding.GreeterService#greet$typeInstance.getTypeName()($typeInstance.getTypeName() param)
+ */
+ public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) {
+ return service.greet$typeInstance.getTypeName()(param);
+ }
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
new file mode 100644
index 0000000000..1fd7509667
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/GreeterServiceImpl.java.vm
@@ -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 $template.getJavaPackage();
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+#end
+#end
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The automcatically generated service implementation that reflects data objects
+ * that are sent to it
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+@Service(GreeterService.class)
+public class GreeterServiceImpl implements GreeterService {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ /**
+ * Take the provided data object, change it slightly and return it
+ *
+ * @param param the data object to be changed and returned
+ * @return the change data object
+ */
+ public $typeInstance.getTypeName() greet$typeInstance.getTypeName()($typeInstance.getTypeName() param) {
+ $typeInstance.getModifyTypeCode()
+ return param;
+ }
+#end
+#end
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/generate.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/generate.xsd
new file mode 100644
index 0000000000..1fabedf55f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/generate/generate.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/generate"
+ xmlns:tns="http://www.apache.org/tuscany/generate">
+
+ <complexType name="TypeType">
+ <sequence>
+ <element name="TypeName" type="string"/>
+ <element name="CreateTypeCode" type="string"/>
+ <element name="ModifyTypeCode" type="string"/>
+ <element name="ResultComparison" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="InputFileType">
+ <sequence>
+ <element name="FileName" type="string"/>
+ <element name="FilePath" type="string"/>
+ <element name="JavaPackage" type="string"/>
+ <element name="Factory" type="string"/>
+ <element name="Namespace" type="string"/>
+ <element name="Prefix" type="string"/>
+ <element name="Type" type="tns:TypeType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="TemplateType">
+ <sequence>
+ <element name="TemplateName" type="string"/>
+ <element name="TemplateTargetDir" type="string"/>
+ <element name="JavaPackage" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="GenerateType">
+ <sequence>
+ <element name="Template" type="tns:TemplateType" maxOccurs="unbounded"/>
+ <element name="InputFile" type="tns:InputFileType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="Generate" type="tns:GenerateType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/wsdl/Dummy.txt b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/wsdl/Dummy.txt
new file mode 100644
index 0000000000..8927d725b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/wsdl/Dummy.txt
@@ -0,0 +1,4 @@
+A dummy file that causes the target/classes/wsdl dir to be created in the generated test project. This is
+required because the test generator must run in the process-resource phase, after generate.xml has been copied
+into target. The generator needs to write out target/classes/wsdl and will fail the directory isn't there. So
+this file just gets unpacked and forces the directory to be created.
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xml
new file mode 100644
index 0000000000..f1f4346e58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xml
@@ -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.
+-->
+<tns:Annotation xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Annotation.xsd">
+ <SimpleTypeWithNameElement>SimpleTypeWithName</SimpleTypeWithNameElement>
+</tns:Annotation>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xsd
new file mode 100644
index 0000000000..1fae43eb09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Annotation.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <annotation>
+ <appinfo>SDO 2.0.1</appinfo>
+ <documentation>
+ A schema that tests the presence of annotations in schema read by SDO
+ </documentation>
+ </annotation>
+
+ <complexType name="AnnotationComplexType">
+ <sequence>
+ <element name="SimpleTypeWithNameElement" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="Annotation" type="tns:AnnotationComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xml
new file mode 100644
index 0000000000..c20c80b658
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xml
@@ -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.
+-->
+<tns:Attribute xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Attribute.xsd ">
+ <AttributeElement Attribute="Attribute"/>
+</tns:Attribute>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xsd
new file mode 100644
index 0000000000..bd3db2e030
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Attribute.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeType">
+ <sequence>
+ </sequence>
+ <attribute name="Attribute" type="string"/>
+ </complexType>
+
+ <complexType name="AttributeComplexType">
+ <sequence>
+ <element name="AttributeElement" type="tns:AttributeType"/>
+ </sequence>
+ </complexType>
+
+ <element name="Attribute" type="tns:AttributeComplexType"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml
new file mode 100644
index 0000000000..30e4979dca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xml
@@ -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.
+-->
+<tns:AttributeReference xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeReference.xsd ">
+ <AttributeReferenceElement tns:ReferencedAttribute="AttributeReference"/>
+</tns:AttributeReference>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd
new file mode 100644
index 0000000000..e7738dcff7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeReference.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <attribute name="ReferencedAttribute" type="string"/>
+
+ <complexType name="AttributeReferenceComplexType">
+ <sequence>
+ </sequence>
+ <attribute ref="tns:ReferencedAttribute"/>
+ </complexType>
+
+ <element name="AttributeReference">
+ <complexType>
+ <sequence>
+ <element name="AttributeReferenceElement" type="tns:AttributeReferenceComplexType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml
new file mode 100644
index 0000000000..9552421e2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xml
@@ -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.
+-->
+<tns:AttributeWithDefaultValueElement xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithDefaultValue.xsd ">
+ <AttributeWithDefaultValueElement AttributeWithDefaultValue="AttributeWithDefaultValueDefaultValue"/>
+</tns:AttributeWithDefaultValueElement>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd
new file mode 100644
index 0000000000..c7b9655749
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithDefaultValue.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithDefaultValueType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithDefaultValue" type="string" default="AttributeWithDefaultValueDefaultValue"/>
+ </complexType>
+
+ <element name="AttributeWithDefaultValueElement">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithDefaultValueElement" type="tns:AttributeWithDefaultValueType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml
new file mode 100644
index 0000000000..5e5e7fbd55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xml
@@ -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.
+-->
+<tns:AttributeWithFixedValueType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithFixedValue.xsd ">
+ <AttributeWithFixedValueElement AttributeWithFixedValue="AttributeWithFixedValueFixedValue"/>
+</tns:AttributeWithFixedValueType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd
new file mode 100644
index 0000000000..5c455c2ab5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithFixedValue.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithFixedValueType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithFixedValue" type="string" fixed="AttributeWithFixedValueFixedValue"/>
+ </complexType>
+
+ <element name="AttributeWithFixedValueType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithFixedValueElement" type="tns:AttributeWithFixedValueType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml
new file mode 100644
index 0000000000..635e851632
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xml
@@ -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.
+-->
+<tns:AttributeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOAliasName.xsd ">
+ <AttributeWithSDOAliasNameElement AttributeWithSDOAliasName="AttributeWithSDOAliasName"/>
+</tns:AttributeWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..004dab4fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOAliasName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOAliasNameType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOAliasName" sdo:aliasName="AttributeWithSDOAliasNameSDOAliasName" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOAliasNameElement" type="tns:AttributeWithSDOAliasNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml
new file mode 100644
index 0000000000..136092951b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xml
@@ -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.
+-->
+<tns:AttributeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDODataType.xsd ">
+ <AttributeWithSDODataTypeTypeElement AttributeWithSDODataType="AttributeWithSDODataType"/>
+</tns:AttributeWithSDODataType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd
new file mode 100644
index 0000000000..796f08e1cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDODataType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDODataTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDODataType" sdo:dataType="string" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDODataType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDODataTypeTypeElement" type="tns:AttributeWithSDODataTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml
new file mode 100644
index 0000000000..927b94885c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xml
@@ -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.
+-->
+<tns:AttributeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOName.xsd ">
+ <AttributeWithSDONameElement AttributeWithSDOName="AttributeWithSDOName"/>
+</tns:AttributeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd
new file mode 100644
index 0000000000..93f83cd0a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDONameType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOName" sdo:name="AttributeWithSDONameSDOName" type="string"/>
+ </complexType>
+
+ <element name="AttributeWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDONameElement" type="tns:AttributeWithSDONameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml
new file mode 100644
index 0000000000..ea7db70595
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xml
@@ -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.
+-->
+<tns:AttributeWithSDOPropertySDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertySDOOppositePropertyType.xsd ">
+ <AttributeWithSDOPropertySDOOppositePropertyTypeElement AttributeWithSDOPropertySDOOppositePropertyType="idvalue0"/>
+</tns:AttributeWithSDOPropertySDOOppositePropertyType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..c64323e7e1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertySDOOppositePropertyType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOPropertySDOOppositePropertyTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertySDOOppositePropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:AttributeWithSDOPropertyType"/>
+ </complexType>
+
+ <element name="AttributeWithSDOPropertySDOOppositePropertyType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOPropertySDOOppositePropertyTypeElement" type="tns:AttributeWithSDOPropertySDOOppositePropertyTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..85c7d85fd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xml
@@ -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.
+-->
+<tns:AttributeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOPropertyType.xsd ">
+ <AttributeWithSDOPropertyTypeElement AttributeWithSDOPropertyType="idvalue0"/>
+</tns:AttributeWithSDOPropertyType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..543f276c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOPropertyType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOPropertyTypeType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ </complexType>
+
+ <element name="AttributeWithSDOPropertyType">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOPropertyTypeElement" type="tns:AttributeWithSDOPropertyTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml
new file mode 100644
index 0000000000..fcd281539b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xml
@@ -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.
+-->
+<tns:AttributeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop AttributeWithSDOString.xsd ">
+ <AttributeWithSDOStringElement AttributeWithSDOString="AttributeWithSDOString"/>
+</tns:AttributeWithSDOString>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd
new file mode 100644
index 0000000000..1610c2b861
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/AttributeWithSDOString.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="AttributeWithSDOStringType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOString" type="string" sdo:string="true"/>
+ </complexType>
+
+ <element name="AttributeWithSDOString">
+ <complexType>
+ <sequence>
+ <element name="AttributeWithSDOStringElement" type="tns:AttributeWithSDOStringType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml
new file mode 100644
index 0000000000..36a0760a61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xml
@@ -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.
+-->
+<tns:BuiltInAnySimpleType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnySimpleType.xsd ">
+ <anySimpleType>anySimpleType</anySimpleType>
+</tns:BuiltInAnySimpleType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd
new file mode 100644
index 0000000000..999b72bb35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnySimpleType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnySimpleType">
+ <complexType>
+ <sequence>
+ <element name="anySimpleType" type="anySimpleType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml
new file mode 100644
index 0000000000..5849165fe0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xml
@@ -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.
+-->
+<tns:BuiltInAnyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyType.xsd ">
+ <anyType xsi:type="anyType"/>
+</tns:BuiltInAnyType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd
new file mode 100644
index 0000000000..71dad561ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnyType">
+ <complexType>
+ <sequence>
+ <element name="anyType" type="anyType" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml
new file mode 100644
index 0000000000..8acf9376d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xml
@@ -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.
+-->
+<tns:BuiltInAnyURI xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInAnyURI.xsd ">
+ <anyURI>http://tempuri.org</anyURI>
+</tns:BuiltInAnyURI>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd
new file mode 100644
index 0000000000..a49987c352
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInAnyURI.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInAnyURI">
+ <complexType>
+ <sequence>
+ <element name="anyURI" type="anyURI" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml
new file mode 100644
index 0000000000..a35b6e174a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xml
@@ -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.
+-->
+<tns:BuildInBase64Binary xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBase64Binary.xsd ">
+ <base64Binary>ABCDEF</base64Binary>
+</tns:BuildInBase64Binary>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd
new file mode 100644
index 0000000000..e1995890f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBase64Binary.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuildInBase64Binary">
+ <complexType>
+ <sequence>
+ <element name="base64Binary" type="base64Binary" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml
new file mode 100644
index 0000000000..91cfce51b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xml
@@ -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.
+-->
+<tns:BuiltInBoolean xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInBoolean.xsd ">
+ <boolean>true</boolean>
+ <boolean>false</boolean>
+ <boolean>1</boolean>
+ <boolean>0</boolean>
+</tns:BuiltInBoolean>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd
new file mode 100644
index 0000000000..a2f86ba8c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInBoolean.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInBoolean">
+ <complexType>
+ <sequence>
+ <element name="boolean" type="boolean" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml
new file mode 100644
index 0000000000..907474cd1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInByte xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInByte.xsd ">
+ <byte>127</byte>
+ <byte>-127</byte>
+</tns:BuiltInByte>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd
new file mode 100644
index 0000000000..a2f6bcfa77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInByte.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInByte">
+ <complexType>
+ <sequence>
+ <element name="byte" type="byte" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml
new file mode 100644
index 0000000000..c5820e1a2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xml
@@ -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.
+-->
+<tns:BuiltInDate xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDate.xsd ">
+ <date>2001-01-01</date>
+</tns:BuiltInDate>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd
new file mode 100644
index 0000000000..f4d596bfe3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDate.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDate">
+ <complexType>
+ <sequence>
+ <element name="date" type="date" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml
new file mode 100644
index 0000000000..0debe2fec5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xml
@@ -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.
+-->
+<tns:BuiltInDateTime xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDateTime.xsd ">
+ <dateTime>2001-12-31T12:00:00</dateTime>
+</tns:BuiltInDateTime>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd
new file mode 100644
index 0000000000..b5bcfdcfd4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDateTime.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDateTime">
+ <complexType>
+ <sequence>
+ <element name="dateTime" type="dateTime" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml
new file mode 100644
index 0000000000..7f001254cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDecimal xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDecimal.xsd ">
+ <decimal>-1.23456789</decimal>
+ <decimal>1.23456789</decimal>
+</tns:BuiltInDecimal>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd
new file mode 100644
index 0000000000..8d4d106f59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDecimal.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDecimal">
+ <complexType>
+ <sequence>
+ <element name="decimal" type="decimal" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml
new file mode 100644
index 0000000000..f875b9f94d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInDouble xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDouble.xsd ">
+ <double>0.0</double>
+ <double>12.3E-4</double>
+</tns:BuiltInDouble>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd
new file mode 100644
index 0000000000..4c8a39b06c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDouble.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDouble">
+ <complexType>
+ <sequence>
+ <element name="double" type="double" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml
new file mode 100644
index 0000000000..7d343d6dda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xml
@@ -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.
+-->
+<tns:BuiltInDuration xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInDuration.xsd ">
+ <duration>P1D</duration>
+</tns:BuiltInDuration>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd
new file mode 100644
index 0000000000..bb12bc04a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInDuration.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInDuration">
+ <complexType>
+ <sequence>
+ <element name="duration" type="duration" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml
new file mode 100644
index 0000000000..7a81f3b0dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xml
@@ -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.
+-->
+<tns:BuiltInFloat xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInFloat.xsd ">
+ <float>0.0</float>
+</tns:BuiltInFloat>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd
new file mode 100644
index 0000000000..f0e1c21233
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInFloat.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInFloat">
+ <complexType>
+ <sequence>
+ <element name="float" type="float" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml
new file mode 100644
index 0000000000..d35568b3c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xml
@@ -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.
+-->
+<tns:BuiltInGDay xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGDay.xsd ">
+ <gDay>---01</gDay>
+</tns:BuiltInGDay>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd
new file mode 100644
index 0000000000..92bd9a4b66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGDay.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGDay">
+ <complexType>
+ <sequence>
+ <element name="gDay" type="gDay" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml
new file mode 100644
index 0000000000..52cdfa8c4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xml
@@ -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.
+-->
+<tns:BuiltInGMonth xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonth.xsd ">
+ <gMonth>--01--</gMonth>
+</tns:BuiltInGMonth>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd
new file mode 100644
index 0000000000..78d001a585
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonth.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGMonth">
+ <complexType>
+ <sequence>
+ <element name="gMonth" type="gMonth" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml
new file mode 100644
index 0000000000..2609a858f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xml
@@ -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.
+-->
+<tns:BuiltInGMonthDay xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGMonthDay.xsd ">
+ <gMonthDay>--01-01</gMonthDay>
+</tns:BuiltInGMonthDay>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd
new file mode 100644
index 0000000000..38f6c55059
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGMonthDay.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGMonthDay">
+ <complexType>
+ <sequence>
+ <element name="gMonthDay" type="gMonthDay" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml
new file mode 100644
index 0000000000..7868a47ca3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xml
@@ -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.
+-->
+<tns:BuiltInGYear xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYear.xsd ">
+ <gYear>2001</gYear>
+</tns:BuiltInGYear>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd
new file mode 100644
index 0000000000..0d65b124ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYear.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGYear">
+ <complexType>
+ <sequence>
+ <element name="gYear" type="gYear" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml
new file mode 100644
index 0000000000..3f5080d49f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xml
@@ -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.
+-->
+<tns:BuiltInGYearMonth xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInGYearMonth.xsd ">
+ <gYearMonth>2001-01</gYearMonth>
+</tns:BuiltInGYearMonth>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd
new file mode 100644
index 0000000000..340555dc5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInGYearMonth.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInGYearMonth">
+ <complexType>
+ <sequence>
+ <element name="gYearMonth" type="gYearMonth" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml
new file mode 100644
index 0000000000..0deb7af980
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xml
@@ -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.
+-->
+<tns:BuiltInHexBinary xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInHexBinary.xsd ">
+ <hexBinary>0F00</hexBinary>
+</tns:BuiltInHexBinary>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd
new file mode 100644
index 0000000000..8059fe6da0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInHexBinary.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInHexBinary">
+ <complexType>
+ <sequence>
+ <element name="hexBinary" type="hexBinary" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml
new file mode 100644
index 0000000000..06c92ce19b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xml
@@ -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.
+-->
+<tns:BuiltInID xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInID.xsd ">
+ <ID>idvalue0</ID>
+</tns:BuiltInID>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd
new file mode 100644
index 0000000000..7b1f02d1d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInID.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInID">
+ <complexType>
+ <sequence>
+ <element name="ID" type="ID" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml
new file mode 100644
index 0000000000..9bc0cefd0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xml
@@ -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.
+-->
+<tns:BuiltInIDREF xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREF.xsd ">
+ <IDREF>idvalue0</IDREF>
+</tns:BuiltInIDREF>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd
new file mode 100644
index 0000000000..0c207983bc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREF.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInIDREF">
+ <complexType>
+ <sequence>
+ <element name="IDREF" type="IDREF" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml
new file mode 100644
index 0000000000..f91b602f99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xml
@@ -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.
+-->
+<tns:BuiltInIDREFS xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInIDREFS.xsd ">
+ <IDREFS>idvalue0</IDREFS>
+</tns:BuiltInIDREFS>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd
new file mode 100644
index 0000000000..b99bf01b73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInIDREFS.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInIDREFS">
+ <complexType>
+ <sequence>
+ <element name="IDREFS" type="IDREFS" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml
new file mode 100644
index 0000000000..c99698e175
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInInt xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInt.xsd ">
+ <int>-2147483648</int>
+ <int>2147483647</int>
+</tns:BuiltInInt>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd
new file mode 100644
index 0000000000..b5b9b0d1eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInt.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInInt">
+ <complexType>
+ <sequence>
+ <element name="int" type="int" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml
new file mode 100644
index 0000000000..80d22ce057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInInteger.xsd ">
+ <integer>-2147483648</integer>
+ <integer>2147483647</integer>
+</tns:BuiltInInteger>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd
new file mode 100644
index 0000000000..4902935db5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInInteger.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInInteger">
+ <complexType>
+ <sequence>
+ <element name="integer" type="integer" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml
new file mode 100644
index 0000000000..664bf824b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xml
@@ -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.
+-->
+<tns:BuiltInLanguage xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLanguage.xsd ">
+ <language>EN</language>
+</tns:BuiltInLanguage>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd
new file mode 100644
index 0000000000..5d3658d224
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLanguage.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInLanguage">
+ <complexType>
+ <sequence>
+ <element name="language" type="language" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml
new file mode 100644
index 0000000000..c5861fa92a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInLong xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInLong.xsd ">
+ <long>-9223372036854775808</long>
+ <long>9223372036854775807</long>
+</tns:BuiltInLong>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd
new file mode 100644
index 0000000000..0aa4710057
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInLong.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+<notation name="interop50" public="commonj.sdo"/>
+
+ <element name="BuiltInLong">
+ <complexType>
+ <sequence>
+ <element name="long" type="long" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml
new file mode 100644
index 0000000000..1f95950394
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xml
@@ -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.
+-->
+<tns:BuiltInNCName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNCName.xsd ">
+ <NCName>NCName</NCName>
+</tns:BuiltInNCName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd
new file mode 100644
index 0000000000..6ee9c435db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNCName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNCName">
+ <complexType>
+ <sequence>
+ <element name="NCName" type="NCName" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml
new file mode 100644
index 0000000000..0297f1aeb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xml
@@ -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.
+-->
+<tns:BuildInNMTOKEN xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKEN.xsd ">
+ <NMTOKEN>NMTOKEN</NMTOKEN>
+</tns:BuildInNMTOKEN>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd
new file mode 100644
index 0000000000..56d027bdbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKEN.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuildInNMTOKEN">
+ <complexType>
+ <sequence>
+ <element name="NMTOKEN" type="NMTOKEN" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml
new file mode 100644
index 0000000000..81ba1069bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xml
@@ -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.
+-->
+<tns:BuiltInNMTOKENS xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNMTOKENS.xsd ">
+ <NMTOKENS>NMTOKENS</NMTOKENS>
+</tns:BuiltInNMTOKENS>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd
new file mode 100644
index 0000000000..866ab73024
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNMTOKENS.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNMTOKENS">
+ <complexType>
+ <sequence>
+ <element name="NMTOKENS" type="NMTOKENS" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml
new file mode 100644
index 0000000000..8bb3a08b94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xml
@@ -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.
+-->
+<tns:BuiltInNOTATION xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNOTATION.xsd ">
+ <NOTATION>tns:BuiltInNotationNotation</NOTATION>
+</tns:BuiltInNOTATION>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd
new file mode 100644
index 0000000000..c7c62f812b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNOTATION.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <notation name="BuiltInNotationNotation" public="http://cwiki.apache.org/confluence/display/TUSCANY/Home"/>
+
+ <element name="BuiltInNOTATION">
+ <complexType>
+ <sequence>
+ <element name="NOTATION" maxOccurs="unbounded">
+ <simpleType >
+ <restriction base="NOTATION">
+ <enumeration value="tns:BuiltInNotationNotation"/>
+ </restriction>
+ </simpleType>
+ </element>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml
new file mode 100644
index 0000000000..8235718c5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xml
@@ -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.
+-->
+<tns:BuiltInName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInName.xsd ">
+ <Name>Name</Name>
+</tns:BuiltInName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd
new file mode 100644
index 0000000000..36caba2f16
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInName">
+ <complexType>
+ <sequence>
+ <element name="Name" type="Name" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml
new file mode 100644
index 0000000000..599c428a44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xml
@@ -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.
+-->
+<tns:BuiltInNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNegativeInteger.xsd ">
+ <negativeInteger>-1</negativeInteger>
+</tns:BuiltInNegativeInteger>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd
new file mode 100644
index 0000000000..389d5a99f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNegativeInteger.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNegativeInteger">
+ <complexType>
+ <sequence>
+ <element name="negativeInteger" type="negativeInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml
new file mode 100644
index 0000000000..919c4a20ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xml
@@ -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.
+-->
+<tns:BuiltInNonNegativeInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonNegativeInteger.xsd ">
+ <nonNegativeInteger>0</nonNegativeInteger>
+</tns:BuiltInNonNegativeInteger>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd
new file mode 100644
index 0000000000..59887078b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonNegativeInteger.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNonNegativeInteger">
+ <complexType>
+ <sequence>
+ <element name="nonNegativeInteger" type="nonNegativeInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml
new file mode 100644
index 0000000000..79011f26ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xml
@@ -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.
+-->
+<tns:BuiltInNonPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNonPositiveInteger.xsd ">
+ <nonPositiveInteger>-1</nonPositiveInteger>
+</tns:BuiltInNonPositiveInteger>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd
new file mode 100644
index 0000000000..5de7d64d7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNonPositiveInteger.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNonPositiveInteger">
+ <complexType>
+ <sequence>
+ <element name="nonPositiveInteger" type="nonPositiveInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml
new file mode 100644
index 0000000000..c40be9e18b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xml
@@ -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.
+-->
+<tns:BuiltInNormalizedString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInNormalizedString.xsd ">
+ <normalizedString>normalizedString</normalizedString>
+</tns:BuiltInNormalizedString>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd
new file mode 100644
index 0000000000..d4a78787b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInNormalizedString.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInNormalizedString">
+ <complexType>
+ <sequence>
+ <element name="normalizedString" type="normalizedString" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml
new file mode 100644
index 0000000000..c30434de66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xml
@@ -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.
+-->
+<tns:BuiltInPositiveInteger xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInPositiveInteger.xsd ">
+ <positiveInteger>1</positiveInteger>
+</tns:BuiltInPositiveInteger>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd
new file mode 100644
index 0000000000..5381590cd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInPositiveInteger.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInPositiveInteger">
+ <complexType>
+ <sequence>
+ <element name="positiveInteger" type="positiveInteger" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml
new file mode 100644
index 0000000000..4cd6ea7e72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xml
@@ -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.
+-->
+<tns:BuiltInQName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInQName.xsd ">
+ <QName>QName</QName>
+</tns:BuiltInQName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd
new file mode 100644
index 0000000000..e8faf6225b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInQName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInQName">
+ <complexType>
+ <sequence>
+ <element name="QName" type="QName" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml
new file mode 100644
index 0000000000..b4375467c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInShort xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInShort.xsd ">
+ <short>-32768</short>
+ <short>32767</short>
+</tns:BuiltInShort>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd
new file mode 100644
index 0000000000..a4f564d9b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInShort.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInShort">
+ <complexType>
+ <sequence>
+ <element name="short" type="short" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml
new file mode 100644
index 0000000000..d30ab85530
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xml
@@ -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.
+-->
+<tns:BuiltInString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInString.xsd ">
+ <string>string</string>
+</tns:BuiltInString>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd
new file mode 100644
index 0000000000..8abb34b5a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInString.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInString">
+ <complexType>
+ <sequence>
+ <element name="string" type="string" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml
new file mode 100644
index 0000000000..7fd9a061ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xml
@@ -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.
+-->
+<tns:BuiltInTime xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInTime.xsd ">
+ <time>12:00:00</time>
+</tns:BuiltInTime>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd
new file mode 100644
index 0000000000..1615976813
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInTime.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInTime">
+ <complexType>
+ <sequence>
+ <element name="time" type="time" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml
new file mode 100644
index 0000000000..cd567ba528
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xml
@@ -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.
+-->
+<tns:BuiltInToken xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInToken.xsd ">
+ <token>token</token>
+</tns:BuiltInToken>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd
new file mode 100644
index 0000000000..0beaac571f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInToken.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInToken">
+ <complexType>
+ <sequence>
+ <element name="token" type="token" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml
new file mode 100644
index 0000000000..025362defb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedByte xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedByte.xsd ">
+ <unsignedByte>0</unsignedByte>
+ <unsignedByte>255</unsignedByte>
+</tns:BuiltInUnsignedByte>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd
new file mode 100644
index 0000000000..d6d951fe5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedByte.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedByte">
+ <complexType>
+ <sequence>
+ <element name="unsignedByte" type="unsignedByte" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml
new file mode 100644
index 0000000000..5736a8c121
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedInt xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedInt.xsd ">
+ <unsignedInt>0</unsignedInt>
+ <unsignedInt>4294967295</unsignedInt>
+</tns:BuiltInUnsignedInt>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd
new file mode 100644
index 0000000000..242be1d53b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedInt.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedInt">
+ <complexType>
+ <sequence>
+ <element name="unsignedInt" type="unsignedInt" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml
new file mode 100644
index 0000000000..d728115a77
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedLong xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedLong.xsd ">
+ <unsignedLong>0</unsignedLong>
+ <unsignedLong>18446744073709551615</unsignedLong>
+</tns:BuiltInUnsignedLong>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd
new file mode 100644
index 0000000000..108e3a8619
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedLong.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedLong">
+ <complexType>
+ <sequence>
+ <element name="unsignedLong" type="unsignedLong" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml
new file mode 100644
index 0000000000..d4ffae5e17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:BuiltInUnsignedShort xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop BuiltInUnsignedShort.xsd ">
+ <unsignedShort>0</unsignedShort>
+ <unsignedShort>65535</unsignedShort>
+</tns:BuiltInUnsignedShort>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd
new file mode 100644
index 0000000000..5ee5e0229e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/BuiltInUnsignedShort.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="BuiltInUnsignedShort">
+ <complexType>
+ <sequence>
+ <element name="unsignedShort" type="unsignedShort" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..3d5aed5aa8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xml
@@ -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.
+-->
+<tns:ComplexTypeComplexContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeComplexContentRestrictingComplexType.xsd ">
+ <ComplexTypeComplexContentRestrictingComplexTypeElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeComplexContentRestrictingComplexTypeElement>
+</tns:ComplexTypeComplexContentRestrictingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..e7b80ab11c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeComplexContentRestrictingComplexType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/>
+
+ <complexType name="ComplexTypeComplexContentRestrictingComplexTypeType">
+ <complexContent>
+ <restriction base="tns:ComplexTypeExtendingComplexTypeType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </restriction>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeComplexContentRestrictingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeComplexContentRestrictingComplexTypeElement" type="tns:ComplexTypeComplexContentRestrictingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml
new file mode 100644
index 0000000000..2b4fe5594e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xml
@@ -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.
+-->
+<tns:ComplexTypeExtendingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingComplexType.xsd ">
+ <ComplexTypeExtendingComplexTypeElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ <SimpleTypeWithNameExtended>SimpleTypeWithNameExtended</SimpleTypeWithNameExtended>
+ </ComplexTypeExtendingComplexTypeElement>
+</tns:ComplexTypeExtendingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd
new file mode 100644
index 0000000000..fc4deb63c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingComplexType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeWithContent.xsd"/>
+
+ <complexType name="ComplexTypeExtendingComplexTypeType">
+ <complexContent>
+ <extension base="tns:ComplexTypeWithContentType">
+ <sequence>
+ <element name="SimpleTypeWithNameExtended" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeExtendingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeExtendingComplexTypeElement" type="tns:ComplexTypeExtendingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml
new file mode 100644
index 0000000000..03570f41d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xml
@@ -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.
+-->
+<tns:ComplexTypeExtendingSimpeType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeExtendingSimpleType.xsd ">
+ <ComplexTypeExtendingSimpeTypeElement AddedByExtension="">ComplexTypeExtendingSimpeTypeElement</ComplexTypeExtendingSimpeTypeElement>
+</tns:ComplexTypeExtendingSimpeType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd
new file mode 100644
index 0000000000..c754502645
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeExtendingSimpleType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeExtendingSimpleTypeType">
+ <simpleContent>
+ <extension base="tns:SimpleTypeWithNameType">
+ <attribute name="AddedByExtension" type="string"/>
+ </extension>
+ </simpleContent>
+ </complexType>
+
+ <element name="ComplexTypeExtendingSimpeType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeExtendingSimpeTypeElement" type="tns:ComplexTypeExtendingSimpleTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml
new file mode 100644
index 0000000000..4603793bfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xml
@@ -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.
+-->
+<tns:ComplexTypeSimpleContentRestrictingComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeSimpleContentRestrictingComplexType.xsd ">
+ <ComplexTypeSimpleContentRestrictingComplexTypeElement AddedByExtension="NCName">ComplexTypeSimpleContentRestrictingComplexTypeElement</ComplexTypeSimpleContentRestrictingComplexTypeElement>
+</tns:ComplexTypeSimpleContentRestrictingComplexType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd
new file mode 100644
index 0000000000..4bcd2f8c46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeSimpleContentRestrictingComplexType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/>
+
+ <complexType name="ComplexTypeSimpleContentRestrictingComplexTypeType">
+ <simpleContent>
+ <restriction base="tns:ComplexTypeExtendingSimpleTypeType">
+ <attribute name="AddedByExtension" type="NCName" />
+ </restriction>
+ </simpleContent>
+ </complexType>
+
+ <element name="ComplexTypeSimpleContentRestrictingComplexType">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeSimpleContentRestrictingComplexTypeElement" type="tns:ComplexTypeSimpleContentRestrictingComplexTypeType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml
new file mode 100644
index 0000000000..a6861f803a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xml
@@ -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.
+-->
+<tns:ComplexTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithAbstract.xsd ">
+ <ComplexTypeWithAbstractExtensionElement>
+ <BaseElement>BaseElement</BaseElement>
+ <ExtensionElement>ExtensionElement</ExtensionElement>
+ </ComplexTypeWithAbstractExtensionElement>
+</tns:ComplexTypeWithAbstract>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd
new file mode 100644
index 0000000000..8bb251cab2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithAbstract.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithAbstractType" abstract="true">
+ <sequence>
+ <element name="BaseElement" type="string"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="ComplexTypeWithAbstractExtensionType">
+ <complexContent>
+ <extension base="tns:ComplexTypeWithAbstractType">
+ <sequence>
+ <element name="ExtensionElement" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ComplexTypeWithAbstract">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithAbstractExtensionElement" type="tns:ComplexTypeWithAbstractExtensionType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml
new file mode 100644
index 0000000000..467ec007ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xml
@@ -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.
+-->
+<tns:ComplexTypeWithCDATA xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithCDATA.xsd ">
+ <ComplexTypeWithCDATAElement>
+ Some
+ <![CDATA[some data and some <MoreXML></MoreXML>]]>
+ Mixed
+ <SimpleTypeWithName>SimpleType<![CDATA[some data and some <MoreXML></MoreXML>]]>WithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithCDATAElement>
+</tns:ComplexTypeWithCDATA>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd
new file mode 100644
index 0000000000..8d00646678
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithCDATA.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithCDATAType" mixed="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithCDATA">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithCDATAElement" type="tns:ComplexTypeWithCDATAType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml
new file mode 100644
index 0000000000..7deafd798a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xml
@@ -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.
+-->
+<tns:ComplexTypeWithContent xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithContent.xsd ">
+ <ComplexTypeWithContentElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithContentElement>
+</tns:ComplexTypeWithContent>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd
new file mode 100644
index 0000000000..72ac75fee0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithContent.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithContentType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithContentElement" type="tns:ComplexTypeWithContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml
new file mode 100644
index 0000000000..f6208f81b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xml
@@ -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.
+-->
+<tns:ComplexTypeWithMixed xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithMixed.xsd ">
+ <ComplexTypeWithMixedElement>
+ Some
+ Mixed
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithMixedElement>
+</tns:ComplexTypeWithMixed>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd
new file mode 100644
index 0000000000..1f26e13673
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithMixed.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithMixedType" mixed="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithMixed">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithMixedElement" type="tns:ComplexTypeWithMixedType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml
new file mode 100644
index 0000000000..97de7b98eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xml
@@ -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.
+-->
+<tns:ComplexTypeWithOpenAttributes xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenAttributes.xsd ">
+ <ComplexTypeWithOpenAttributesElement SomeOpenAttribute="Some Open Attribute">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithOpenAttributesElement>
+</tns:ComplexTypeWithOpenAttributes>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd
new file mode 100644
index 0000000000..67716553d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenAttributes.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <attribute name="SomeOpenAttribute" type="string"/>
+
+ <complexType name="ComplexTypeWithOpenAttributesType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ <anyAttribute namespace="##any"/>
+ </complexType>
+
+ <element name="ComplexTypeWithOpenAttributes">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithOpenAttributesElement" type="tns:ComplexTypeWithOpenAttributesType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml
new file mode 100644
index 0000000000..5941348921
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xml
@@ -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.
+-->
+<tns:ComplexTypeWithOpenContent xmlns:tns="http://www.apache.org/tuscany/interop" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOpenContent.xsd ">
+ <ComplexTypeWithOpenContentElement>
+ <tns:ComplexTypeWithMixed>
+ <ComplexTypeWithMixedElement>
+ Some
+ Mixed
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ Content
+ </ComplexTypeWithMixedElement>
+ </tns:ComplexTypeWithMixed>
+ </ComplexTypeWithOpenContentElement>
+</tns:ComplexTypeWithOpenContent>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd
new file mode 100644
index 0000000000..24d5d09054
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOpenContent.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="ComplexTypeWithMixed.xsd"/>
+
+ <complexType name="ComplexTypeWithOpenContentType">
+ <sequence>
+ <any namespace="##any"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithOpenContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithOpenContentElement" type="tns:ComplexTypeWithOpenContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml
new file mode 100644
index 0000000000..f684d06a4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xml
@@ -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.
+-->
+<tns:ComplexTypeWithOppositeProperty xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithOppositeProperty.xsd ">
+ <ComplexTypeReferencedDataObject DataObjectId="idvalue0">
+ <SomeData>SomeData</SomeData>
+ </ComplexTypeReferencedDataObject>
+ <ComplexTypeReferencingDataObject AttributeWithSDOPropertyType="idvalue0" DataObjectId="idvalue1">
+ <OppositeProperty>idvalue2</OppositeProperty>
+ </ComplexTypeReferencingDataObject>
+ <ComplexTypeWithOppositePropertyElement AttributeWithSDOPropertyType="idvalue1" DataObjectId="idvalue2"/>
+</tns:ComplexTypeWithOppositeProperty>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd
new file mode 100644
index 0000000000..de4a8a666d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithOppositeProperty.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeReferencedDataObjectType">
+ <sequence>
+ <element name="SomeData" type="string"/>
+ </sequence>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <complexType name="ComplexTypeReferencingDataObjectType">
+ <sequence>
+ <element name="OppositeProperty" type="IDREF"/>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF"
+ sdo:propertyType="tns:ComplexTypeReferencedDataObjectType"/>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <complexType name="ComplexTypeWithOppositePropertyType">
+ <sequence>
+ </sequence>
+ <attribute name="AttributeWithSDOPropertyType" type="IDREF"
+ sdo:propertyType="tns:ComplexTypeReferencingDataObjectType"
+ sdo:oppositeProperty="OppositeProperty"/>
+ <attribute name="DataObjectId" type="ID"/>
+ </complexType>
+
+ <element name="ComplexTypeWithOppositeProperty">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeReferencedDataObject" type="tns:ComplexTypeReferencedDataObjectType"/>
+ <element name="ComplexTypeReferencingDataObject" type="tns:ComplexTypeReferencingDataObjectType"/>
+ <element name="ComplexTypeWithOppositePropertyElement" type="tns:ComplexTypeWithOppositePropertyType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml
new file mode 100644
index 0000000000..242908bd27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xml
@@ -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.
+-->
+<tns:ComplexTypeWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOAliasName.xsd ">
+ <ComplexTypeWithSDOAliasNameElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDOAliasNameElement>
+</tns:ComplexTypeWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd
new file mode 100644
index 0000000000..4c00fbe295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOAliasName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeWithSDOAliasNameType" sdo:aliasName="ComplexTypeWithSDOAliasNameTypeSDOAliasName">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDOAliasNameElement" type="tns:ComplexTypeWithSDOAliasNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml
new file mode 100644
index 0000000000..925e8625d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xml
@@ -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.
+-->
+<tns:ComplexTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOName.xsd ">
+ <ComplexTypeWithSDONameElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDONameElement>
+</tns:ComplexTypeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd
new file mode 100644
index 0000000000..b12bec040b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <complexType name="ComplexTypeWithSDONameType" sdo:name="ComplexTypeWithSDONameTypeSDOName">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDONameElement" type="tns:ComplexTypeWithSDONameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml
new file mode 100644
index 0000000000..c73708ce46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xml
@@ -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.
+-->
+<tns:ComplexTypeWithSDOSequence xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithSDOSequence.xsd ">
+ <ComplexTypeWithSDOSequenceElement>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </ComplexTypeWithSDOSequenceElement>
+</tns:ComplexTypeWithSDOSequence>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd
new file mode 100644
index 0000000000..795c3ea7d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithSDOSequence.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+
+ <complexType name="ComplexTypeWithSDOSequenceType" sdo:sequence="true">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType" />
+ </sequence>
+ </complexType>
+
+ <element name="ComplexTypeWithSDOSequence">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithSDOSequenceElement" type="tns:ComplexTypeWithSDOSequenceType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml
new file mode 100644
index 0000000000..3ebdc89ae0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xml
@@ -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.
+-->
+<tns:ComplexTypeWithoutContent xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutContent.xsd ">
+ <ComplexTypeWithoutContentElement/>
+</tns:ComplexTypeWithoutContent>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd
new file mode 100644
index 0000000000..21546d0f67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutContent.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeWithoutContentType"/>
+
+ <element name="ComplexTypeWithoutContent">
+ <complexType>
+ <sequence>
+ <element name="ComplexTypeWithoutContentElement" type="tns:ComplexTypeWithoutContentType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml
new file mode 100644
index 0000000000..89657e42ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xml
@@ -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.
+-->
+<tns:ComplexTypeWithoutName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ComplexTypeWithoutName.xsd ">
+ <tns:ComplexTypeWithoutNameType>
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ </tns:ComplexTypeWithoutNameType>
+</tns:ComplexTypeWithoutName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd
new file mode 100644
index 0000000000..d01b4172e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ComplexTypeWithoutName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ComplexTypeWithoutNameType">
+ <complexType>
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="ComplexTypeWithoutName">
+ <complexType>
+ <sequence>
+ <element ref="tns:ComplexTypeWithoutNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml
new file mode 100644
index 0000000000..82fd1eedaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<DefaultNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="DefaultNamespace.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</DefaultNamespace>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd
new file mode 100644
index 0000000000..e1dcf06194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/DefaultNamespace.xsd
@@ -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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
+
+ <!-- top level test type -->
+ <xsd:complexType name="DefaultNamespaceComplexType">
+ <xsd:sequence>
+ <!-- simple types -->
+ <xsd:element name="SimpleTypeWithName" type="xsd:string"/>
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="Default" type="DefaultNamespaceComplexType"/>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml
new file mode 100644
index 0000000000..ebf03c9d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xml
@@ -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.
+-->
+<tns:ElementInAll xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInAll.xsd ">
+ <ElementInAllElement>
+ <ElementInAllOne>ElementInAllOne</ElementInAllOne>
+ <ElementInAllTwo>ElementInAllTwo</ElementInAllTwo>
+ </ElementInAllElement>
+</tns:ElementInAll>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd
new file mode 100644
index 0000000000..8b9ba5b4b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInAll.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeElementInAllTestType">
+ <all>
+ <element name="ElementInAllOne" type="string"/>
+ <element name="ElementInAllTwo" type="string"/>
+ </all>
+ </complexType>
+
+ <element name="ElementInAll">
+ <complexType>
+ <sequence>
+ <choice maxOccurs="3">
+ <element name="ElementInAllElement" type="tns:ComplexTypeElementInAllTestType"/>
+ </choice>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml
new file mode 100644
index 0000000000..26466b1b39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementInChoice xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementInChoice.xsd ">
+ <Element1InChoice>Element1InChoice</Element1InChoice>
+ <Element2InChoice>Element2InChoice</Element2InChoice>
+</tns:ElementInChoice>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd
new file mode 100644
index 0000000000..ff418c56ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementInChoice.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <group name="Group1">
+ <sequence>
+ <element name="Element1InChoice" type="string" maxOccurs="2"/>
+ <element name="Element2InChoice" type="string" />
+ </sequence>
+ </group>
+
+ <group name="Group2">
+ <sequence>
+ <element name="Element2InChoice" type="string" />
+ <element name="Element1InChoice" type="string" maxOccurs="2"/>
+ </sequence>
+ </group>
+
+ <element name="ElementInChoice">
+ <complexType>
+ <sequence>
+ <choice maxOccurs="3">
+ <group ref="tns:Group1"/>
+ <group ref="tns:Group2"/>
+ </choice>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml
new file mode 100644
index 0000000000..27bb1ce9cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xml
@@ -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.
+-->
+<tns:ElementOfSDOChangeSummaryType xmlns:sdo="commonj.sdo"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSDOChangeSummaryType.xsd commonj.sdo datagraph.xsd ">
+ <ElementOfSDOChangeSummaryTypeElement>
+ <ChangeSummaryElement>
+ ChangeSummaryText
+ </ChangeSummaryElement>
+ </ElementOfSDOChangeSummaryTypeElement>
+</tns:ElementOfSDOChangeSummaryType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd
new file mode 100644
index 0000000000..2bf1df8c99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSDOChangeSummaryType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <import schemaLocation="datagraph.xsd" namespace="commonj.sdo"/>
+
+ <element name="ElementOfSDOChangeSummaryType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSDOChangeSummaryTypeElement" type="sdo:ChangeSummaryType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml
new file mode 100644
index 0000000000..9b5561ed43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithDefault xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithDefault.xsd ">
+ <ElementOfSimpleTypeWithDefaultElement>ElementOfSimpleTypeWithDefaultDefault</ElementOfSimpleTypeWithDefaultElement>
+</tns:ElementOfSimpleTypeWithDefault>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd
new file mode 100644
index 0000000000..0b4e7bdf45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithDefault.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementOfSimpleTypeWithDefault">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithDefaultElement" type="string" default="ElementOfSimpleTypeWithDefaultDefault" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml
new file mode 100644
index 0000000000..f1b7cd264c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithFixed xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithFixed.xsd ">
+ <ElementOfSimpleTypeWithFixedElement>ElementOfSimpleTypeWithFixedFixed</ElementOfSimpleTypeWithFixedElement>
+</tns:ElementOfSimpleTypeWithFixed>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd
new file mode 100644
index 0000000000..a2c8456257
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithFixed.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementOfSimpleTypeWithFixed">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithFixedElement" type="string" fixed="ElementOfSimpleTypeWithFixedFixed" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml
new file mode 100644
index 0000000000..1f60b0423f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithSDODataType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDODataType.xsd ">
+ <ElementOfSimpleTypeWithSDODataTypeElement>ElementOfSimpleTypeWithSDODataTypeElement</ElementOfSimpleTypeWithSDODataTypeElement>
+</tns:ElementOfSimpleTypeWithSDODataType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd
new file mode 100644
index 0000000000..21e55ab8c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDODataType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+
+ <element name="ElementOfSimpleTypeWithSDODataType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDODataTypeElement" type="string" sdo:dataType="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml
new file mode 100644
index 0000000000..30762f4912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithSDOOppositePropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOOppositePropertyType.xsd ">
+ <ElementOfSimpleTypeWithSDOOppositePropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOOppositePropertyTypeElement>
+</tns:ElementOfSimpleTypeWithSDOOppositePropertyType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd
new file mode 100644
index 0000000000..5bf35d0d70
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOOppositePropertyType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+
+ <element name="ElementOfSimpleTypeWithSDOOppositePropertyType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOOppositePropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType" sdo:oppositeProperty="tns:ElementOfSimpleTypeWithSDOPropertyType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml
new file mode 100644
index 0000000000..2dd01e4090
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithSDOPropertyType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOPropertyType.xsd ">
+ <ElementOfSimpleTypeWithSDOPropertyTypeElement>idvalue0</ElementOfSimpleTypeWithSDOPropertyTypeElement>
+</tns:ElementOfSimpleTypeWithSDOPropertyType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd
new file mode 100644
index 0000000000..6920cd8dd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOPropertyType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementOfSimpleTypeWithSDOPropertyType">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOPropertyTypeElement" type="IDREF" sdo:propertyType="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml
new file mode 100644
index 0000000000..6a526bdc47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xml
@@ -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.
+-->
+<tns:ElementOfSimpleTypeWithSDOString xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementOfSimpleTypeWithSDOString.xsd ">
+ <ElementOfSimpleTypeWithSDOStringElement>ElementOfSimpleTypeWithSDOStringElement</ElementOfSimpleTypeWithSDOStringElement>
+</tns:ElementOfSimpleTypeWithSDOString>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd
new file mode 100644
index 0000000000..1117a95eb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementOfSimpleTypeWithSDOString.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementOfSimpleTypeWithSDOString">
+ <complexType>
+ <sequence>
+ <element name="ElementOfSimpleTypeWithSDOStringElement" type="string" sdo:string="true"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xml
new file mode 100644
index 0000000000..ab91458bff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.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.
+-->
+<tns:ElementSubstitutionGroupBase xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementSubstitutionGroupBase.xsd ">
+ <ElementSubstitutionGroupBaseElement>
+ <ElementInSubstitutionGroupBase>
+ ElementInSubstitutionGroupBase
+ </ElementInSubstitutionGroupBase>
+ </ElementSubstitutionGroupBaseElement>
+
+ <ElementSubstitutionUnrelated>Some Data</ElementSubstitutionUnrelated>
+
+ <ElementSubstitutionGroupExtends>
+ <ElementInSubstitutionGroupBase>
+ ElementInSubstitutionGroupBase
+ </ElementInSubstitutionGroupBase>
+ <ElementInSubstitutionGroupExtends>
+ ElementInSubstitutionGroupExtends
+ </ElementInSubstitutionGroupExtends>
+ </ElementSubstitutionGroupExtends>
+
+</tns:ElementSubstitutionGroupBase>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd
new file mode 100644
index 0000000000..3e015843b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementSubstitutionGroupBase.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupBase" type="string"/>
+ </sequence>
+ </complexType>
+ <element name="ElementSubstitutionGroupBaseElement" type="tns:ComplexTypeSubstitutionGroupBaseType"/>
+
+ <element name="ElementSubstitutionGroupUnrelated" type="string" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/>
+
+ <complexType name="ComplexTypeSubstitutionGroupExtendsType">
+ <complexContent>
+ <extension base="tns:ComplexTypeSubstitutionGroupBaseType">
+ <sequence>
+ <element name="ElementInSubstitutionGroupExtends" type="string"/>
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
+ <element name="ElementSubstitutionGroupExtends" type="tns:ComplexTypeSubstitutionGroupExtendsType" substitutionGroup="tns:ElementSubstitutionGroupBaseElement"/>
+
+ <element name="ElementSubstitutionGroupBase">
+ <complexType>
+ <sequence>
+ <element ref="tns:ElementSubstitutionGroupBaseElement" maxOccurs="unbounded" />
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml
new file mode 100644
index 0000000000..b6d68fd08a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:ElementWithMaxOccurs xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithMaxOccurs.xsd ">
+ <ElementWithMaxOccursElement>ElementWithMaxOccursElement1</ElementWithMaxOccursElement>
+ <ElementWithMaxOccursElement>ElementWithMaxOccursElement2</ElementWithMaxOccursElement>
+</tns:ElementWithMaxOccurs>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd
new file mode 100644
index 0000000000..d4453a4477
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithMaxOccurs.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementWithMaxOccurs">
+ <complexType>
+ <sequence>
+ <element name="ElementWithMaxOccursElement" type="string" maxOccurs="2"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml
new file mode 100644
index 0000000000..6de3adc937
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xml
@@ -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.
+-->
+<tns:ElementWithNillable xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithNillable.xsd ">
+ <ElementWithNillableElement>ElementWithNillableElement</ElementWithNillableElement>
+</tns:ElementWithNillable>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd
new file mode 100644
index 0000000000..786ab226da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithNillable.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="ElementWithNillable">
+ <complexType>
+ <sequence>
+ <element name="ElementWithNillableElement" type="string" nillable="true" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml
new file mode 100644
index 0000000000..64093aa803
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xml
@@ -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.
+-->
+<tns:ElementWithSDOAliasName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOAliasName.xsd ">
+ <ElementWithSDOAliasName>ElementWithSDOAliasName</ElementWithSDOAliasName>
+</tns:ElementWithSDOAliasName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd
new file mode 100644
index 0000000000..01f4c2b1ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOAliasName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementWithSDOAliasName">
+ <complexType>
+ <sequence>
+ <element name="ElementWithSDOAliasName" sdo:aliasName="ElementWithSDOAliasNameSDOAliasName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml
new file mode 100644
index 0000000000..774646f682
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xml
@@ -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.
+-->
+<tns:ElementWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop ElementWithSDOName.xsd ">
+ <ElementWithSDONameElement>ElementWithSDONameElement</ElementWithSDONameElement>
+</tns:ElementWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd
new file mode 100644
index 0000000000..34da37564c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ElementWithSDOName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <element name="ElementWithSDOName">
+ <complexType>
+ <sequence>
+ <element name="ElementWithSDONameElement" sdo:name="ElementWithSDONameSDOName" type="string"/>
+ </sequence>
+ </complexType>
+ </element>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml
new file mode 100644
index 0000000000..a1fb3aa803
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xml
@@ -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.
+-->
+<tns:GlobalElementComplexType xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementComplexType.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:GlobalElementComplexType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd
new file mode 100644
index 0000000000..8eb7a4fce4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementComplexType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <complexType name="GlobalElementComplexTypeComplexType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="string"/>
+ </sequence>
+ </complexType>
+
+ <element name="GlobalElementComplexType" type="tns:GlobalElementComplexTypeComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml
new file mode 100644
index 0000000000..f68eb1939d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xml
@@ -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.
+-->
+<GlobalElementSimpleType xmlns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop GlobalElementSimpleType.xsd">
+ GlobalElementSimpleType
+</GlobalElementSimpleType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd
new file mode 100644
index 0000000000..b9f77e6658
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/GlobalElementSimpleType.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+
+ <element name="GlobalElementSimpleType" type="string"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xml
new file mode 100644
index 0000000000..fd28850050
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xml
@@ -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.
+-->
+<tns:Import xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Import.xsd">
+
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+ <Imported>
+ <AnElement>SomeString</AnElement>
+ <AnotherElement>SomeString</AnotherElement>
+ </Imported>
+</tns:Import>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xsd
new file mode 100644
index 0000000000..eae93fd44a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Import.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoJava="commonj.sdo">
+
+ <include schemaLocation="SimpleTypeWithName.xsd"/>
+ <import schemaLocation="ImportedSchema.xsd"
+ namespace="http://www.apache.org/tuscany/interop/import"/>
+
+ <!-- top level test type -->
+ <complexType name="ImportComplexType">
+ <sequence>
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+ <element name="Imported" type="imp:ImportedComplexType"/>
+ </sequence>
+ </complexType>
+
+ <element name="Import" type="tns:ImportComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd
new file mode 100644
index 0000000000..a7e568decf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/ImportedSchema.xsd
@@ -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.
+-->
+
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:imp="http://www.apache.org/tuscany/interop/import"
+ targetNamespace="http://www.apache.org/tuscany/interop/import">
+
+ <xsd:complexType name="ImportedComplexType">
+ <xsd:sequence>
+ <xsd:element name="AnElement" type="xsd:string"/>
+ <xsd:element name="AnotherElement" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xml
new file mode 100644
index 0000000000..d4b9e24fa6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xml
@@ -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.
+-->
+<tns:Include xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Include.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:Include>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xsd
new file mode 100644
index 0000000000..34ff314a19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Include.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <include schemaLocation="../xsd/SimpleTypeWithName.xsd"/>
+
+ <!-- top level test type -->
+ <complexType name="IncludeComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="IncludeElement" type="tns:IncludeComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Interop.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Interop.xsd
new file mode 100644
index 0000000000..ae22ab2c44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Interop.xsd
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+<!-- Causes SDO generator to crash
+ <include schemaLocation="../xsd/Annotation.xsd"/>
+-->
+ <include schemaLocation="../xsd/Attribute.xsd"/>
+ <include schemaLocation="../xsd/AttributeReference.xsd"/>
+<!--
+ <include schemaLocation="AttributeWithDefaultValue.xsd"/>
+ <include schemaLocation="AttributeWithFixedValue.xsd"/>
+ <include schemaLocation="AttributeWithSDOAliasName.xsd"/>
+ <include schemaLocation="AttributeWithSDODataType.xsd"/>
+ <include schemaLocation="AttributeWithSDOName.xsd"/>
+ <include schemaLocation="AttributeWithSDOPropertySDOOppositePropertyType.xsd"/>
+ <include schemaLocation="AttributeWithSDOPropertyType.xsd"/>
+ <include schemaLocation="AttributeWithSDOString.xsd"/>
+ <include schemaLocation="BuiltInAnySimpleType.xsd"/>
+ <include schemaLocation="BuiltInAnyType.xsd"/>
+ <include schemaLocation="BuiltInAnyURI.xsd"/>
+ <include schemaLocation="BuiltInBase64Binary.xsd"/>
+ <include schemaLocation="BuiltInBoolean.xsd"/>
+ <include schemaLocation="BuiltInByte.xsd"/>
+ <include schemaLocation="BuiltInDate.xsd"/>
+ <include schemaLocation="BuiltInDateTime.xsd"/>
+ <include schemaLocation="BuiltInDecimal.xsd"/>
+ <include schemaLocation="BuiltInDouble.xsd"/>
+ <include schemaLocation="BuiltInDuration.xsd"/>
+ <include schemaLocation="BuiltInFloat.xsd"/>
+ <include schemaLocation="BuiltInGDay.xsd"/>
+ <include schemaLocation="BuiltInGMonth.xsd"/>
+ <include schemaLocation="BuiltInGMonthDay.xsd"/>
+ <include schemaLocation="BuiltInGYear.xsd"/>
+ <include schemaLocation="BuiltInGYearMonth.xsd"/>
+ <include schemaLocation="BuiltInHexBinary.xsd"/>
+ <include schemaLocation="BuiltInID.xsd"/>
+ <include schemaLocation="BuiltInIDREF.xsd"/>
+ <include schemaLocation="BuiltInIDREFS.xsd"/>
+ <include schemaLocation="BuiltInInt.xsd"/>
+ <include schemaLocation="BuiltInInteger.xsd"/>
+ <include schemaLocation="BuiltInLanguage.xsd"/>
+ <include schemaLocation="BuiltInLong.xsd"/>
+ <include schemaLocation="BuiltInNCName.xsd"/>
+ <include schemaLocation="BuiltInNMTOKEN.xsd"/>
+ <include schemaLocation="BuiltInNMTOKENS.xsd"/>
+ <include schemaLocation="BuiltInNOTATION.xsd"/>
+ <include schemaLocation="BuiltInName.xsd"/>
+ <include schemaLocation="BuiltInNegativeInteger.xsd"/>
+ <include schemaLocation="BuiltInNonNegativeInteger.xsd"/>
+ <include schemaLocation="BuiltInNonPositiveInteger.xsd"/>
+ <include schemaLocation="BuiltInNormalizedString.xsd"/>
+ <include schemaLocation="BuiltInPositiveInteger.xsd"/>
+ <include schemaLocation="BuiltInQName.xsd"/>
+ <include schemaLocation="BuiltInShort.xsd"/>
+ <include schemaLocation="BuiltInString.xsd"/>
+ <include schemaLocation="BuiltInTime.xsd"/>
+ <include schemaLocation="BuiltInToken.xsd"/>
+ <include schemaLocation="BuiltInUnsignedByte.xsd"/>
+ <include schemaLocation="BuiltInUnsignedInt.xsd"/>
+ <include schemaLocation="BuiltInUnsignedLong.xsd"/>
+ <include schemaLocation="BuiltInUnsignedShort.xsd"/>
+ <include schemaLocation="ComplexTypeComplexContentRestrictingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeExtendingSimpleType.xsd"/>
+ <include schemaLocation="ComplexTypeSimpleContentRestrictingComplexType.xsd"/>
+ <include schemaLocation="ComplexTypeWithAbstract.xsd"/>
+ <include schemaLocation="ComplexTypeWithCDATA.xsd"/>
+-->
+ <include schemaLocation="../xsd/ComplexTypeWithContent.xsd"/>
+<!--
+ <include schemaLocation="ComplexTypeWithMixed.xsd"/>
+ <include schemaLocation="ComplexTypeWithOpenAttributes.xsd"/>
+ <include schemaLocation="ComplexTypeWithOpenContent.xsd"/>
+ <include schemaLocation="ComplexTypeWithOppositeProperty.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOAliasName.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOName.xsd"/>
+ <include schemaLocation="ComplexTypeWithSDOSequence.xsd"/>
+ <include schemaLocation="ComplexTypeWithoutContent.xsd"/>
+ <include schemaLocation="ComplexTypeWithoutName.xsd"/>
+ <include schemaLocation="DefaultNamespace.xsd"/>
+ <include schemaLocation="ElementInAll.xsd"/>
+ <include schemaLocation="ElementInChoice.xsd"/>
+ <include schemaLocation="ElementOfSDOChangeSummaryType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithDefault.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithFixed.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDODataType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOOppositePropertyType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOPropertyType.xsd"/>
+ <include schemaLocation="ElementOfSimpleTypeWithSDOString.xsd"/>
+ <include schemaLocation="ElementSubstitutionGroupBase.xsd"/>
+ <include schemaLocation="ElementWithMaxOccurs.xsd"/>
+ <include schemaLocation="ElementWithNillable.xsd"/>
+ <include schemaLocation="ElementWithSDOAliasName.xsd"/>
+ <include schemaLocation="ElementWithSDOName.xsd"/>
+ <include schemaLocation="GlobalElementComplexType.xsd"/>
+ <include schemaLocation="GlobalElementSimpleType.xsd"/>
+ <include schemaLocation="Import.xsd"/>
+ <include schemaLocation="ImportedSchema.xsd"/>
+-->
+ <include schemaLocation="../xsd/Include.xsd"/>
+<!--
+ <include schemaLocation="Notation.xsd"/>
+ <include schemaLocation="SDOJavaPackage.xsd"/>
+-->
+ <include schemaLocation="../xsd/SimpleTypeWithAbstract.xsd"/>
+<!--
+ <include schemaLocation="SimpleTypeWithExtendedInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithInstanceClass.xsd"/>
+ <include schemaLocation="SimpleTypeWithList.xsd"/>
+-->
+ <include schemaLocation="../xsd/SimpleTypeWithName.xsd"/>
+<!--
+ <include schemaLocation="SimpleTypeWithSDOName.xsd"/>
+ <include schemaLocation="SimpleTypeWithUnion.xsd"/>
+ <include schemaLocation="SimpleTypeWithoutName.xsd"/>
+ <include schemaLocation="TargetNamespace.xsd"/>
+-->
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xml
new file mode 100644
index 0000000000..b75ac6500a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xml
@@ -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.
+-->
+<tns:Notation xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop Notation.xsd ">
+tns:Tuscany
+</tns:Notation>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xsd
new file mode 100644
index 0000000000..6ad019cb81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Notation.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <notation name="Tuscany" public="http://cwiki.apache.org/TUSCANY/"/>
+ <notation name="PHP_SCA_SDO" public="http://pecl.php.net/package/sca_sdo/"/>
+
+ <simpleType name="NotationSimpleType">
+ <restriction base="NOTATION">
+ <enumeration value="tns:Tuscany"/>
+ <enumeration value="tns:PHP_SCA_SDO"/>
+ </restriction>
+ </simpleType>
+
+ <element name="Notation" type="tns:NotationSimpleType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Person.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Person.xsd
new file mode 100644
index 0000000000..5f5021b15e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/Person.xsd
@@ -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.
+-->
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/types">
+
+ <xsd:complexType name="PersonType">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="greeting" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml
new file mode 100644
index 0000000000..6c5ad88ff4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SDOJavaPackage xmlns:p="commonj.sdo"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop interop05.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:SDOJavaPackage>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd
new file mode 100644
index 0000000000..6b7e39b334
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SDOJavaPackage.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo/java"
+ sdoJava:package="org.apache.tuscany">
+
+ <!-- should be a reference to the real schema wherever that is going to be -->
+ <import schemaLocation="sdoJava.xsd" namespace="commonj.sdo/java"/>
+
+ <!-- top level test type -->
+ <complexType name="SDOJavaPackageComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="string"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="SDOJavaPackage" type="tns:SDOJavaPackageComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml
new file mode 100644
index 0000000000..f9d4a24a49
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xml
@@ -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.
+-->
+<tns:SimpleTypeWithAbstract xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithAbstract.xsd ">
+ <SimpleTypeWithAbstractExtensionElement>SimpleTypeWithAbstractExtensionElement</SimpleTypeWithAbstractExtensionElement>
+</tns:SimpleTypeWithAbstract>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd
new file mode 100644
index 0000000000..f649e2ba83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithAbstract.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <!--simpleType name="SimpleTypeWithAbstractType" abstract="true"-->
+ <simpleType name="SimpleTypeWithAbstractType" >
+ <restriction base="string"/>
+ </simpleType>
+
+ <simpleType name="SimpleTypeWithAbstractExtensionType">
+ <restriction base="tns:SimpleTypeWithAbstractType"/>
+ </simpleType>
+
+ <complexType name="SimpleTypeWithAbstractComplexType">
+ <sequence>
+ <element name="SimpleTypeWithAbstractExtensionElement" type="tns:SimpleTypeWithAbstractExtensionType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithAbstract" type="tns:SimpleTypeWithAbstractComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml
new file mode 100644
index 0000000000..410df4b7e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xml
@@ -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.
+-->
+<tns:SimpleTypeWithExtendedInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithExtendedInstanceClass.xsd ">
+ <SimpleTypeWithExtendedInstanceClassElement>SimpleTypeWithExtendedInstanceClassElement</SimpleTypeWithExtendedInstanceClassElement>
+</tns:SimpleTypeWithExtendedInstanceClass>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
new file mode 100644
index 0000000000..36629e8295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithExtendedInstanceClass.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithExtendedInstanceClassType" sdoJava:extendedInstanceClass="String">
+ <restriction base="string"/>
+ </simpleType>
+
+ <complexType name="SimpleTypeWithExtendedInstanceClassComplexType">
+ <sequence>
+ <element name="SimpleTypeWithExtendedInstanceClassElement" type="tns:SimpleTypeWithExtendedInstanceClassType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithExtendedInstanceClass" type="SimpleTypeWithExtendedInstanceClassComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml
new file mode 100644
index 0000000000..7b74867c03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xml
@@ -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.
+-->
+<tns:SimpleTypeWithInstanceClass xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithInstanceClass.xsd ">
+ <SimpleTypeWithInstanceClassElement>SimpleTypeWithInstanceClassElement</SimpleTypeWithInstanceClassElement>
+</tns:SimpleTypeWithInstanceClass>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
new file mode 100644
index 0000000000..7a08de84be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithInstanceClass.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithInstanceClassType" sdoJava:instanceClass="String">
+ <restriction base="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithInstanceClassComplexType">
+ <sequence>
+ <element name="SimpleTypeWithInstanceClassElement" type="tns:SimpleTypeWithInstanceClassType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithInstanceClass" type="SimpleTypeWithInstanceClassComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml
new file mode 100644
index 0000000000..708d526f44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xml
@@ -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.
+-->
+<tns:SimpleTypeWithList xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithList.xsd ">
+ <SimpleTypeWithListElement>listmember1 listmember2</SimpleTypeWithListElement>
+</tns:SimpleTypeWithList>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
new file mode 100644
index 0000000000..681cf7d5af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithList.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithListType">
+ <list itemType="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithListComplexType">
+ <sequence>
+ <element name="SimpleTypeWithListElement" type="tns:SimpleTypeWithListType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithList" type="SimpleTypeWithListComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml
new file mode 100644
index 0000000000..e404ac86b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xml
@@ -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.
+-->
+<tns:SimpleTypeWithName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithName.xsd ">
+ <SimpleTypeWithNameElement>SimpleTypeWithNameElement</SimpleTypeWithNameElement>
+</tns:SimpleTypeWithName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd
new file mode 100644
index 0000000000..af0431f048
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <simpleType name="SimpleTypeWithNameType">
+ <restriction base="string"/>
+ </simpleType>
+
+ <complexType name="SimpleTypeWithNameComplexType">
+ <sequence>
+ <element name="SimpleTypeWithNameElement" type="tns:SimpleTypeWithNameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameComplexType"/>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml
new file mode 100644
index 0000000000..c86a0f6bcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xml
@@ -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.
+-->
+<tns:SimpleTypeWithSDOName xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithSDOName.xsd ">
+ <SimpleTypeWithSDONameElement>SimpleTypeWithSDONameElement</SimpleTypeWithSDONameElement>
+</tns:SimpleTypeWithSDOName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd
new file mode 100644
index 0000000000..89b00a36cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithSDOName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdo="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithSDONameType" sdo:name="SimpleTypeWithSDONameTypeSDOName">
+ <restriction base="string"/>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithSDONameComplexType">
+ <sequence>
+ <element name="SimpleTypeWithSDONameElement" type="tns:SimpleTypeWithSDONameType"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithSDOName" type="tns:SimpleTypeWithSDONameComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml
new file mode 100644
index 0000000000..399b0d8175
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:SimpleTypeWithUnion xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithUnion.xsd ">
+ <SimpleTypeWithUnionElement>EN</SimpleTypeWithUnionElement>
+ <SimpleTypeWithUnionElement>01:02:03</SimpleTypeWithUnionElement>
+</tns:SimpleTypeWithUnion>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
new file mode 100644
index 0000000000..fee04b9f24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithUnion.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:sdoJava="commonj.sdo">
+
+ <simpleType name="SimpleTypeWithUnionType">
+ <union>
+ <simpleType>
+ <restriction base="language">
+ </restriction>
+ </simpleType>
+ <simpleType>
+ <restriction base="time">
+ </restriction>
+ </simpleType>
+ </union>
+ </simpleType>
+
+
+ <complexType name="SimpleTypeWithUnionComplexType">
+ <sequence>
+ <element name="SimpleTypeWithUnionElement" type="tns:SimpleTypeWithUnionType" minOccurs="2" maxOccurs="2"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithUnion" type="SimpleTypeWithUnionComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml
new file mode 100644
index 0000000000..bc8cf35368
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xml
@@ -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.
+-->
+ <SimpleTypeWithoutName xmlns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop SimpleTypeWithoutName.xsd">
+ <SimpleTypeWithoutNameElement>
+ SimpleTypeWithoutName
+ </SimpleTypeWithoutNameElement>
+</SimpleTypeWithoutName>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
new file mode 100644
index 0000000000..536aa822de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/SimpleTypeWithoutName.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <element name="SimpleTypeWithoutNameElement">
+ <simpleType>
+ <restriction base="string"/>
+ </simpleType>
+ </element>
+
+
+ <complexType name="SimpleTypeWithoutNameComplexType">
+ <sequence>
+ <element ref="tns:SimpleTypeWithoutNameElement"/>
+ </sequence>
+ </complexType>
+
+ <element name="SimpleTypeWithoutName" type="SimpleTypeWithoutNameComplexType">
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml
new file mode 100644
index 0000000000..da2929776e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xml
@@ -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.
+-->
+<tns:TargetNamespace xmlns:tns="http://www.apache.org/tuscany/interop"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.apache.org/tuscany/interop TargetNamespace.xsd">
+ <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
+</tns:TargetNamespace>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd
new file mode 100644
index 0000000000..ace5427786
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/TargetNamespace.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.apache.org/tuscany/interop"
+ xmlns:tns="http://www.apache.org/tuscany/interop">
+
+ <!-- top level test type -->
+ <complexType name="TargetNamespaceComplexType">
+ <sequence>
+ <!-- simple types -->
+ <element name="SimpleTypeWithName" type="string"/>
+
+ </sequence>
+ </complexType>
+
+ <element name="TargetNamespace" type="tns:TargetNamespaceComplexType"/>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/datagraph.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/datagraph.xsd
new file mode 100644
index 0000000000..e6b9697a8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/datagraph.xsd
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+-->
+
+<xsd:schema
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoJava="commonj.sdo/java"
+ targetNamespace="commonj.sdo">
+
+ <xsd:element name="datagraph" type="sdo:DataGraphType"/>
+
+ <xsd:complexType name="DataGraphType">
+ <xsd:complexContent>
+ <xsd:extension base="sdo:BaseDataGraphType">
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="1" namespace="##other" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="BaseDataGraphType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="models" type="sdo:ModelsType" minOccurs="0"/>
+ <xsd:element name="xsd" type="sdo:XSDType" minOccurs="0"/>
+ <xsd:element name="changeSummary" type="sdo:ChangeSummaryType" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:anyAttribute namespace="##other" processContents="lax"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="ModelsType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Expected type is emof:Package.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##other" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="XSDType">
+ <xsd:annotation>
+ <xsd:documentation>
+ Expected type is xsd:schema.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- FB TEMP -->
+ <xsd:simpleType name="ChangeSummaryType" sdoJava:instanceClass="commonj.sdo.ChangeSummary">
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+<!--
+ <xsd:complexType name="ChangeSummaryType">
+ <xsd:sequence>
+ <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="##any" processContents="lax"/>
+ </xsd:sequence>
+ <xsd:attribute name="create" type="xsd:string"/>
+ <xsd:attribute name="delete" type="xsd:string"/>
+ <xsd:attribute name="logging" type="xsd:boolean"/>
+ </xsd:complexType>
+-->
+
+ <xsd:attribute name="ref" type="xsd:string"/>
+ <xsd:attribute name="unset" type="xsd:string"/>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd
new file mode 100644
index 0000000000..7387568942
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoJava.xsd
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+-->
+
+<xsd:schema
+ targetNamespace="commonj.sdo/java"
+ xmlns:sdoJava="commonj.sdo/java"
+ xmlns:sdo="commonj.sdo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<xsd:import namespace="commonj.sdo" schemaLocation="sdoModel.xsd"/>
+
+<!--
+ These attributes are used to customize the Java mapping of
+ XSD to SDO Types and Properties.
+-->
+
+<xsd:attribute name="package" type="xsd:string" />
+<xsd:attribute name="instanceClass" type="xsd:string" />
+<xsd:attribute name="extendedInstanceClass" type="xsd:string" />
+<xsd:attribute name="nestedInterfaces" type="xsd:boolean" />
+
+<!--
+ Global properties used in open content for
+ the Java binding of SDO Types and Properties.
+-->
+
+<xsd:attribute name="javaClass" type="sdo:String"/>
+
+<!-- JavaInfo deprecated in 2.1.0 -->
+<xsd:complexType name="JavaInfo">
+ <xsd:attribute name="javaClass" type="sdo:String"/>
+</xsd:complexType>
+
+<!--
+ The Java object data types.
+-->
+
+<xsd:simpleType name="BooleanObject" sdoJava:instanceClass="java.lang.Boolean">
+ <xsd:restriction base="xsd:boolean"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="ByteObject" sdoJava:instanceClass="java.lang.Byte">
+ <xsd:restriction base="xsd:byte"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="CharacterObject" sdoJava:instanceClass="java.lang.Character">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="DoubleObject" sdoJava:instanceClass="java.lang.Double">
+ <xsd:restriction base="xsd:double"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="FloatObject" sdoJava:instanceClass="java.lang.Float">
+ <xsd:restriction base="xsd:float"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="IntObject" sdoJava:instanceClass="java.lang.Integer">
+ <xsd:restriction base="xsd:int"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="LongObject" sdoJava:instanceClass="java.lang.Long">
+ <xsd:restriction base="xsd:long"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="ShortObject" sdoJava:instanceClass="java.lang.Short">
+ <xsd:restriction base="xsd:short"/>
+</xsd:simpleType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd
new file mode 100644
index 0000000000..c5aabc9cc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/main/resources/xsd/sdoModel.xsd
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+/**
+ * <copyright>
+ *
+ * Service Data Objects
+ * Version 2.1.0
+ * Licensed Materials
+ *
+ * (c) Copyright BEA Systems, Inc., International Business Machines Corporation,
+ * Oracle Corporation, Primeton Technologies Ltd., Rogue Wave Software, SAP AG.,
+ * Software AG., Sun Microsystems, Sybase Inc., Xcalia, Zend Technologies,
+ * 2005, 2006. All rights reserved.
+ *
+ * </copyright>
+ *
+ */
+
+-->
+
+<xsd:schema
+ targetNamespace="commonj.sdo"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sdo="commonj.sdo"
+ xmlns:sdoXML="commonj.sdo/xml"
+ xmlns:sdoJava="commonj.sdo/java"
+ elementFormDefault="qualified"
+ xsi:schemaLocation="commonj.sdo/xml sdoXML.xsd
+ commonj.sdo/java sdoJava.xsd">
+
+<xsd:include schemaLocation="datagraph.xsd"/>
+
+<!-- Root element for defining several Types in one document.
+ Is not part of the model.
+-->
+<xsd:element name="types" type="sdo:Types"/>
+<xsd:complexType name="Types">
+ <xsd:sequence>
+ <xsd:element name="type" type="sdo:Type" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<!-- Any data object may be serialized with this element,
+ with xsi:type to declare the
+ actual type of the DataObject serialized.
+-->
+<xsd:element name="dataObject" type="xsd:anyType"/>
+
+<!-- Model Types
+ SDO Type and Property are defined in terms of themselves.
+-->
+<xsd:element name="type" type="sdo:Type"/>
+<xsd:complexType name="Type">
+ <xsd:sequence>
+ <xsd:element name="baseType" type="sdo:URI"
+ minOccurs="0" maxOccurs="unbounded"
+ sdoXML:propertyType="sdo:Type" />
+ <xsd:element name="property" type="sdo:Property"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="aliasName" type="sdo:String"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:ID" sdoXML:dataType="sdo:String"/>
+ <xsd:attribute name="uri" type="sdo:URI"/>
+ <xsd:attribute name="dataType" type="sdo:Boolean"/>
+ <xsd:attribute name="open" type="sdo:Boolean"/>
+ <xsd:attribute name="sequenced" type="sdo:Boolean"/>
+ <xsd:attribute name="abstract" type="sdo:Boolean"/>
+ <xsd:anyAttribute namespace="##any" processContents="lax"/>
+</xsd:complexType>
+
+<xsd:complexType name="Property">
+ <xsd:sequence>
+ <xsd:element name="aliasName" type="sdo:String"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xsd:any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="sdo:String"/>
+ <xsd:attribute name="many" type="sdo:Boolean"/>
+ <xsd:attribute name="containment" type="sdo:Boolean"/>
+ <xsd:attribute name="default" type="sdo:String"/>
+ <xsd:attribute name="readOnly" type="sdo:Boolean"/>
+ <xsd:attribute name="type" type="sdo:URI" sdoXML:propertyType="sdo:Type"/>
+ <xsd:attribute name="opposite" type="sdo:URI" sdoXML:propertyType="sdo:Property"/>
+ <xsd:attribute name="nullable" type="sdo:Boolean"/>
+ <xsd:anyAttribute namespace="##any" processContents="lax"/>
+</xsd:complexType>
+
+<!-- Special Types -->
+<xsd:complexType name="DataObject" abstract="true"/>
+
+<!-- TextType deprecated in 2.1.0 -->
+ <xsd:complexType name="TextType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="text" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+<!-- ChangeSummaryType is defined in datagraph.xsd.
+ Although declared there as a ComplexType,
+ at the model level it is treated as a SimpleType
+ with a special XML serialization.
+-->
+
+<!-- Data Types -->
+<xsd:simpleType name="Boolean" sdoJava:instanceClass="boolean">
+ <xsd:restriction base="xsd:boolean"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Byte" sdoJava:instanceClass="byte">
+ <xsd:restriction base="xsd:byte"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Bytes" sdoJava:instanceClass="byte[]">
+ <xsd:restriction base="xsd:hexBinary"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Character" sdoJava:instanceClass="char">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Date" sdoJava:instanceClass="java.util.Date">
+ <xsd:restriction base="xsd:dateTime"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="DateTime" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:dateTime"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Day" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gDay"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Decimal" sdoJava:instanceClass="java.math.BigDecimal">
+ <xsd:restriction base="xsd:decimal"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Double" sdoJava:instanceClass="double">
+ <xsd:restriction base="xsd:double"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Duration" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:duration"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Float" sdoJava:instanceClass="float">
+ <xsd:restriction base="xsd:float"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Int" sdoJava:instanceClass="int">
+ <xsd:restriction base="xsd:int"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Integer" sdoJava:instanceClass="java.math.BigInteger">
+ <xsd:restriction base="xsd:integer"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Long" sdoJava:instanceClass="long">
+ <xsd:restriction base="xsd:long"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Month" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gMonth"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="MonthDay" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gMonthDay"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Object" sdoJava:instanceClass="java.lang.Object">
+ <!-- Only the schema for schemas is allowed to restrict anySimpleType.
+ <xsd:restriction base="xsd:anySimpleType"/>
+ The equivalent declaration is a union of the predefined XSD data types.
+ -->
+ <xsd:union memberTypes="xsd:anyURI xsd:base64Binary xsd:boolean xsd:byte
+ xsd:date xsd:dateTime xsd:decimal xsd:double xsd:duration xsd:ENTITIES xsd:ENTITY xsd:float
+ xsd:gDay xsd:gMonth xsd:gMonthDay xsd:gYear xsd:gYearMonth xsd:hexBinary xsd:ID xsd:IDREF xsd:IDREFS
+ xsd:int xsd:integer xsd:language xsd:long xsd:Name xsd:NCName xsd:negativeInteger
+ xsd:NMTOKEN xsd:NMTOKENS xsd:nonNegativeInteger xsd:nonPositiveInteger
+ xsd:normalizedString xsd:NOTATION xsd:positiveInteger xsd:QName xsd:short xsd:string
+ xsd:time xsd:token xsd:unsignedByte xsd:unsignedInt xsd:unsignedLong xsd:unsignedShort"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Short" sdoJava:instanceClass="short">
+ <xsd:restriction base="xsd:short"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="String" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Strings" sdoJava:instanceClass="java.util.List">
+ <xsd:restriction base="xsd:string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Time" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:time"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="Year" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gYear"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="YearMonth" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:gYearMonth"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="YearMonthDay" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:date"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="URI" sdoJava:instanceClass="java.lang.String">
+ <xsd:restriction base="xsd:anyURI"/>
+</xsd:simpleType>
+
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.java
new file mode 100644
index 0000000000..131e11012a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/common/src/test/java/org/apache/tuscany/sca/itest/generate/GenerateTestCase.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.itest.generate;
+
+import junit.framework.TestCase;
+
+
+/**
+ *
+ */
+public class GenerateTestCase extends TestCase {
+
+ private Generate generator = null;
+ private static boolean initalised = false;
+
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ generator = new Generate();
+ initalised = true;
+ }
+ }
+
+ protected void tearDown() {
+
+ }
+
+ /**
+ * Invokes the Generate class to generate databinding test classes and resources.
+ *
+ * @throws Exception
+ */
+ public void testGenerate() throws Exception {
+ // generator.generate();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.png b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.png
new file mode 100644
index 0000000000..7912019e9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.svg b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.svg
new file mode 100644
index 0000000000..aaf027e2df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/config.svg
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg3168"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="config.svg">
+ <defs
+ id="defs3170" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="375"
+ inkscape:cy="748.57143"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="990"
+ inkscape:window-height="664"
+ inkscape:window-x="103"
+ inkscape:window-y="84" />
+ <metadata
+ id="metadata3173">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3194"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84"><flowRegion
+ id="flowRegion3196"><rect
+ id="rect3198"
+ width="505.71429"
+ height="531.42859"
+ x="94.285713"
+ y="83.790756" /></flowRegion><flowPara
+ id="flowPara3200">&lt;tns:Generate ...&gt;</flowPara><flowPara
+ id="flowPara3202"> &lt;Template&gt;</flowPara><flowPara
+ id="flowPara3204"> &lt;TemplateName&gt;greeter.composite.vm&lt;/TemplateName&gt;</flowPara><flowPara
+ id="flowPara3206"> &lt;TemplateTargetDir&gt;classes&lt;/TemplateTargetDir&gt;</flowPara><flowPara
+ id="flowPara3208"> &lt;/Template&gt;</flowPara><flowPara
+ id="flowPara3210"> ...</flowPara><flowPara
+ id="flowPara3212"> </flowPara><flowPara
+ id="flowPara3214"> &lt;InputFile&gt;</flowPara><flowPara
+ id="flowPara3216"> &lt;FileName&gt;Person.xsd&lt;/FileName&gt;</flowPara><flowPara
+ id="flowPara3218"> &lt;FilePath&gt;xsd&lt;/FilePath&gt;</flowPara><flowPara
+ id="flowPara3220"> &lt;JavaPackage&gt;org.apache.tuscany.sca.itest.databinding.types&lt;/JavaPackage&gt;</flowPara><flowPara
+ id="flowPara3222"> &lt;Factory&gt;TypesFactory&lt;/Factory&gt;</flowPara><flowPara
+ id="flowPara3224"> &lt;Namespace&gt;http://apache.org/tuscany/sca/itest/databinding/types&lt;/Namespace&gt;</flowPara><flowPara
+ id="flowPara3226"> &lt;Prefix&gt;p&lt;/Prefix&gt;</flowPara><flowPara
+ id="flowPara3228"> &lt;Type&gt;</flowPara><flowPara
+ id="flowPara3230"> &lt;TypeName&gt;PersonType&lt;/TypeName&gt;</flowPara><flowPara
+ id="flowPara3232"> &lt;CreateTypeCode&gt;</flowPara><flowPara
+ id="flowPara3234"> TypesFactory factory = TypesFactory.INSTANCE;</flowPara><flowPara
+ id="flowPara3236"> param = factory.createPersonType();</flowPara><flowPara
+ id="flowPara3238"> param.setFirstName(&quot;George&quot;);</flowPara><flowPara
+ id="flowPara3240"> param.setLastName(&quot;Doors&quot;);</flowPara><flowPara
+ id="flowPara3242"> &lt;/CreateTypeCode&gt;</flowPara><flowPara
+ id="flowPara3244"> &lt;ModifyTypeCode&gt;</flowPara><flowPara
+ id="flowPara3246"> param.setGreeting(&quot;Hello&quot;);</flowPara><flowPara
+ id="flowPara3248"> &lt;/ModifyTypeCode&gt;</flowPara><flowPara
+ id="flowPara3250"> &lt;ResultComparison&gt;</flowPara><flowPara
+ id="flowPara3252"> assertNotSame(&quot;greetedPerson.getGreeting() not set&quot;, &quot;&quot;, result.getGreeting());</flowPara><flowPara
+ id="flowPara3254"> &lt;/ResultComparison&gt;</flowPara><flowPara
+ id="flowPara3256"> &lt;/Type&gt;</flowPara><flowPara
+ id="flowPara3258"> &lt;/InputFile&gt;</flowPara><flowPara
+ id="flowPara3260"> ...</flowPara><flowPara
+ id="flowPara3262"></flowPara><flowPara
+ id="flowPara3264">&lt;/tns:Generate&gt;</flowPara></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.png b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.png
new file mode 100644
index 0000000000..76a9c71b7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.svg b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.svg
new file mode 100644
index 0000000000..d6850ccf7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/databinding.svg
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="databinding.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\databinding.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3078"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="499.13602"
+ inkscape:cy="337.74555"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1180"
+ inkscape:window-height="775"
+ inkscape:window-x="36"
+ inkscape:window-y="42" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.084673,0,0,0.856154,-21.78728,27.4907)">
+ <rect
+ rx="15.307091"
+ ry="15.260983"
+ y="192.00233"
+ x="258.31146"
+ height="360.71414"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.07541251;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">GreeterService</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="312.05917"
+ y="258.59619"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(44.4684,52.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">DefaultGreeter</flowPara><flowPara
+ id="flowPara2019">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 294.90867,290.44317 L 328.24371,290.44317 L 334.30462,303.57515 L 327.23356,315.69699 L 294.90867,315.69699 L 302.48482,303.57515 L 294.90867,290.44317 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 408.16111,288.60489 L 441.49615,288.60489 L 447.55706,301.73687 L 440.486,313.85871 L 408.16111,313.85871 L 415.73726,301.73687 L 408.16111,288.60489 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="115.66247"
+ height="85.862968"
+ x="642.96918"
+ y="315.88455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(375.3784,109.946)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">GreeterService</flowPara><flowPara
+ id="flowPara2017">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 625.81867,347.73153 L 659.15371,347.73153 L 665.21462,360.86351 L 658.14356,372.98535 L 625.81867,372.98535 L 633.39482,360.86351 L 625.81867,347.73153 z "
+ id="path1997" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2001"
+ width="115.66247"
+ height="85.862968"
+ x="313.68344"
+ y="371.59885"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2003"
+ transform="translate(46.09269,165.6602)"><flowRegion
+ id="flowRegion2005"><rect
+ id="rect2007"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2009">WSGreeter</flowPara><flowPara
+ id="flowPara2021">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 296.53296,403.44581 L 329.868,403.44581 L 335.92891,416.57779 L 328.85785,428.69963 L 296.53296,428.69963 L 304.10911,416.57779 L 296.53296,403.44581 z "
+ id="path2013" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 409.7854,401.60753 L 443.12044,401.60753 L 449.18135,414.73951 L 442.11029,426.86135 L 409.7854,426.86135 L 417.36155,414.73951 L 409.7854,401.60753 z "
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Lend);stroke-opacity:1"
+ d="M 447.14297,301.23734 L 527.11201,301.95163 L 526.12473,354.09448 L 626.8265,354.80877"
+ id="path2039" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 463.87333,395.75343 L 516.54902,395.75343 L 526.12641,417.42827 L 514.95279,437.43583 L 463.87333,437.43583 L 475.84509,417.42827 L 463.87333,395.75343 z "
+ id="path3108"
+ inkscape:transform-center-y="-33.571429"
+ inkscape:transform-center-x="31.706144" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 535.3019,397.182 L 577.70287,397.182 L 585.41213,416.99969 L 576.41799,435.29297 L 535.3019,435.29297 L 544.93849,416.99969 L 535.3019,397.182 z "
+ id="path3110" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3112"
+ transform="matrix(0.778099,0,0,0.884748,255.7727,214.0266)"><flowRegion
+ id="flowRegion3114"><rect
+ id="rect3116"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3120">WS</flowPara><flowPara
+ id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3128"
+ transform="matrix(0.778099,0,0,0.884748,324.368,215.5376)"><flowRegion
+ id="flowRegion3130"><rect
+ id="rect3132"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3134">WS</flowPara><flowPara
+ id="flowPara3136">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 447.85714,415.52305 L 475.71429,415.52305"
+ id="path3138" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 525.71429,417.66591 L 543.57143,417.66591"
+ id="path3140" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 585.71429,416.23734 L 599.28571,416.23734 L 600,364.80877 L 629.28571,364.80877"
+ id="path3142" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.png b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.png
new file mode 100644
index 0000000000..005e0f24ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.svg b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.svg
new file mode 100644
index 0000000000..03897c6d09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop.svg
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings"
+ sodipodi:docname="interop.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\itest\databindings\interop.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3078"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="428.95418"
+ inkscape:cy="356.33178"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1234"
+ inkscape:window-height="800"
+ inkscape:window-x="27"
+ inkscape:window-y="108" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.979246,0,0,1.158467,-105.7257,-23.34339)">
+ <rect
+ rx="25.230545"
+ ry="12.196672"
+ y="179.85953"
+ x="146.34595"
+ height="288.28497"
+ width="817.08154"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.87776983;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-102.7603,-25.12021)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">InteropGreeterService</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3332"
+ width="115.66247"
+ height="85.862968"
+ x="77.514153"
+ y="231.09024"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3334"
+ transform="translate(-185.0766,21.58025)"><flowRegion
+ id="flowRegion3336"><rect
+ id="rect3338"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3340">SDO</flowPara><flowPara
+ id="flowPara3379">DefaultGreeter</flowPara><flowPara
+ id="flowPara2019">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 60.363662,262.93721 L 93.698702,262.93721 L 99.759609,276.06919 L 92.688552,288.19103 L 60.363662,288.19103 L 67.939812,276.06919 L 60.363662,262.93721 z "
+ id="path3343" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 173.6161,261.09893 L 206.95114,261.09893 L 213.01205,274.23091 L 205.94099,286.35275 L 173.6161,286.35275 L 181.19225,274.23091 L 173.6161,261.09893 z "
+ id="path3345" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1985"
+ width="115.66247"
+ height="85.862968"
+ x="681.65045"
+ y="289.48157"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1987"
+ transform="translate(423.3454,80.68594)"><flowRegion
+ id="flowRegion1989"><rect
+ id="rect1991"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1993">SDO</flowPara><flowPara
+ id="flowPara3399">GreeterService</flowPara><flowPara
+ id="flowPara2017">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 664.49995,321.32854 L 697.83499,321.32854 L 703.8959,334.46052 L 696.82484,346.58236 L 664.49995,346.58236 L 672.0761,334.46052 L 664.49995,321.32854 z "
+ id="path1997" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2001"
+ width="115.66247"
+ height="85.862968"
+ x="76.281281"
+ y="356.23575"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2003"
+ transform="translate(-185.5951,150.2971)"><flowRegion
+ id="flowRegion2005"><rect
+ id="rect2007"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2009">SDO</flowPara><flowPara
+ id="flowPara3401">WSGreeter</flowPara><flowPara
+ id="flowPara2021">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 59.130809,388.08271 L 92.465849,388.08271 L 98.526759,401.21469 L 91.455699,413.33653 L 59.130809,413.33653 L 66.706959,401.21469 L 59.130809,388.08271 z "
+ id="path2013" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 172.38325,386.24443 L 205.71829,386.24443 L 211.7792,399.37641 L 204.70814,411.49825 L 172.38325,411.49825 L 179.9594,399.37641 L 172.38325,386.24443 z "
+ id="path2015" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.47114,380.39017 L 271.82375,380.39017 L 280.06966,400.95073 L 270.44943,419.92971 L 226.47114,419.92971 L 236.77856,400.95073 L 226.47114,380.39017 z "
+ id="path3108"
+ inkscape:transform-center-y="-31.845711"
+ inkscape:transform-center-x="27.298337" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 286.59013,381.79328 L 328.89058,381.79328 L 336.58156,401.62413 L 327.60875,419.92957 L 286.59013,419.92957 L 296.20387,401.62413 L 286.59013,381.79328 z "
+ id="path3110" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3112"
+ transform="matrix(0.654898,0,0,0.869049,51.92158,201.8882)"><flowRegion
+ id="flowRegion3114"><rect
+ id="rect3116"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3120">WS</flowPara><flowPara
+ id="flowPara3124">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3128"
+ transform="matrix(0.654898,0,0,0.869049,112.0605,203.3723)"><flowRegion
+ id="flowRegion3130"><rect
+ id="rect3132"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3134">WS</flowPara><flowPara
+ id="flowPara3136">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3381"
+ width="115.66247"
+ height="85.862968"
+ x="376.54059"
+ y="229.73444"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3383"
+ transform="translate(113.9499,20.22444)"><flowRegion
+ id="flowRegion3385"><rect
+ id="rect3387"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3389">JAXB</flowPara><flowPara
+ id="flowPara3391">DefaultGreeter</flowPara><flowPara
+ id="flowPara3393">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 359.39009,261.5814 L 392.72513,261.5814 L 398.78604,274.71338 L 391.71498,286.83522 L 359.39009,286.83522 L 366.96624,274.71338 L 359.39009,261.5814 z "
+ id="path3395" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 472.64253,259.74312 L 505.97757,259.74312 L 512.03848,272.8751 L 504.96742,284.99694 L 472.64253,284.99694 L 480.21868,272.8751 L 472.64253,259.74312 z "
+ id="path3397" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3403"
+ width="115.66247"
+ height="85.862968"
+ x="375.19193"
+ y="355.69083"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3405"
+ transform="translate(112.6012,146.1808)"><flowRegion
+ id="flowRegion3407"><rect
+ id="rect3409"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3411">JAXB</flowPara><flowPara
+ id="flowPara3413">WSGreeter</flowPara><flowPara
+ id="flowPara3415">ServiceClient</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 358.0414,387.53779 L 391.37644,387.53779 L 397.43735,400.66977 L 390.36629,412.79161 L 358.0414,412.79161 L 365.61755,400.66977 L 358.0414,387.53779 z "
+ id="path3417" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 471.29384,385.69951 L 504.62888,385.69951 L 510.68979,398.83149 L 503.61873,410.95333 L 471.29384,410.95333 L 478.86999,398.83149 L 471.29384,385.69951 z "
+ id="path3419" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 531.84342,380.87285 L 577.19603,380.87285 L 585.44194,401.43341 L 575.82171,420.41239 L 531.84342,420.41239 L 542.15084,401.43341 L 531.84342,380.87285 z "
+ id="path3421"
+ inkscape:transform-center-y="-31.845711"
+ inkscape:transform-center-x="27.298337" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 591.96241,382.27596 L 634.26286,382.27596 L 641.95384,402.10681 L 632.98103,420.41225 L 591.96241,420.41225 L 601.57615,402.10681 L 591.96241,382.27596 z "
+ id="path3423" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3425"
+ transform="matrix(0.654898,0,0,0.869049,357.2939,202.3709)"><flowRegion
+ id="flowRegion3427"><rect
+ id="rect3429"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3431">WS</flowPara><flowPara
+ id="flowPara3433">Reference</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3435"
+ transform="matrix(0.654898,0,0,0.869049,417.4328,203.855)"><flowRegion
+ id="flowRegion3437"><rect
+ id="rect3439"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3441">WS</flowPara><flowPara
+ id="flowPara3443">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 212.14286,274.09448 L 366.42857,274.80877"
+ id="path3447" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 512.14286,272.66591 L 599.28571,272.66591 L 599.28571,325.52305 L 665.71429,325.52305"
+ id="path3453" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 210.71429,399.80877 L 235.71429,399.80877"
+ id="path3455" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 278.57143,401.23734 L 295.71429,401.23734"
+ id="path3459" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 336.42857,401.95163 L 365.71429,401.95163"
+ id="path3461" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 510.71429,399.80877 L 540.71429,399.80877"
+ id="path3463" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 585,401.95163 L 600.71429,401.95163"
+ id="path3465" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 641.42857,402.66591 L 657.14286,402.66591 L 657.85714,339.09448 L 669.28571,339.09448"
+ id="path3467" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/pom.xml
new file mode 100644
index 0000000000..14f94ae740
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/pom.xml
@@ -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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tuscany-itest-databindings-interop</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Interoperability Databindings Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
new file mode 100644
index 0000000000..7bdfc57924
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/InteropDatabindingTestCase.java.vm
@@ -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 $template.getJavaPackage();
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import ${template.getJavaPackage()}.GreeterService;
+
+// Data types
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+import $file.getJavaPackage().$typeInstance.getTypeName();
+import $file.getJavaPackage().$file.getFactory();
+#end
+#end
+
+/**
+ * Automatically generated test case. Calls the greeter client for a number of
+ * bindings and a number of data types.
+ *
+ * @version $Rev: 511417 $ $Date: 2007-02-25 03:06:42 +0000 (Sun, 25 Feb 2007) $
+ */
+public class InteropDatabindingTestCase extends TestCase {
+
+ private static boolean initalised = false;
+ private GreeterService greeterClient;
+ private static SCADomain domain;
+
+ /**
+ * Runs before each test method
+ */
+ protected void setUp() throws Exception {
+ if (!initalised) {
+ domain = SCADomain.newInstance("interopgreeter.composite");
+ super.setUp();
+ initalised = true;
+ }
+ }
+
+ /**
+ * Runs after each test method
+ */
+ protected void tearDown() {
+
+ }
+
+ /**
+ * Finds the SCA component that relates to the protocol being tested. This test
+ * always connects locally to the client component but the client component will
+ * connect to the back end component using the appropriate protocol
+ *
+ * @param ext the protcol required
+ */
+ private void setUpClient(String ext) throws Exception {
+ greeterClient = domain.getService(GreeterService.class, "SDO" + ext + "GreeterServiceClient");
+ }
+
+ /**
+ * Invokes the SDO Greet service using web service bindings with SDO payload
+ */
+ public void testWSGreet() throws Exception {
+ setUpClient("WS");
+ greet();
+ }
+
+ /**
+ * Invokes the SDO Greet service using default bindings with SDO payload
+ */
+ public void testDefaultGreet() throws Exception {
+ setUpClient("Default");
+ greet();
+ }
+
+ /**
+ * A generic method which, regarless of which client is connected, sends out a
+ * series of requrests passing different data types.
+ */
+ public void greet() {
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ // test $typeInstance.getTypeName()
+ {
+ $typeInstance.getTypeName() param = null;
+ $typeInstance.getCreateTypeCode()
+ $typeInstance.getTypeName() result = greeterClient.greet$typeInstance.getTypeName()(param);
+ $typeInstance.getResultComparison()
+ }
+#end
+#end
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
new file mode 100644
index 0000000000..da346f372d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/JAXBGreeter.wsdl.vm
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/jaxb"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/jaxb"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/jaxb"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/JAXBGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
new file mode 100644
index 0000000000..40ccc83302
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/SDOGreeter.wsdl.vm
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/sdo"
+ xmlns:tns="http://apache.org/tuscany/sca/itest/databinding/services/sdo"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ name="Greeter">
+
+ <wsdl:types>
+ <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+#foreach($file in $fileList)
+ xmlns:$file.getPrefix()="$file.getNamespace()"
+#end
+ targetNamespace="http://apache.org/tuscany/sca/itest/databinding/services/sdo"
+ elementFormDefault="qualified">
+
+#foreach($file in $fileList)
+ <xsd:import namespace="$file.getNamespace()"
+ schemaLocation="../xsd/$file.getFileName()" />
+#end
+
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <element name="greet$typeInstance.getTypeName()">
+ <complexType>
+ <sequence>
+ <element name="parm" type="$file.getPrefix():$typeInstance.getTypeName()" />
+ </sequence>
+ </complexType>
+ </element>
+#end
+#end
+ </xsd:schema>
+ </wsdl:types>
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+
+ <wsdl:message name="$typeInstance.getTypeName()Request">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="$typeInstance.getTypeName()Response">
+ <wsdl:part element="tns:greet$typeInstance.getTypeName()" name="parameters" />
+ </wsdl:message>
+#end
+#end
+
+ <wsdl:portType name="GreeterPortType">
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdl:input message="tns:$typeInstance.getTypeName()Request" name="$typeInstance.getTypeName()RequestMsg" />
+ <wsdl:output message="tns:$typeInstance.getTypeName()Response" name="$typeInstance.getTypeName()ResponseMsg" />
+ </wsdl:operation>
+#end
+#end
+ </wsdl:portType>
+
+ <wsdl:binding name="GreeterBinding" type="tns:GreeterPortType">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+#foreach($file in $fileList)
+#set($typeList = $file.getType_())
+#foreach($typeInstance in $typeList)
+ <wsdl:operation name="greet$typeInstance.getTypeName()">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="$typeInstance.getTypeName()RequestMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="$typeInstance.getTypeName()ResponseMsg">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+#end
+#end
+ </wsdl:binding>
+
+ <wsdl:service name="GreeterService">
+ <wsdl:port name="GreeterPort" binding="tns:GreeterBinding">
+ <wsdlsoap:address location="http://localhost:8080/services/SDOGreeterServiceWebServiceBinding" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..8453dd56b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/generate.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+
+ <Template>
+ <TemplateName>InteropDatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>interopgreeter.composite.vm</TemplateName>
+ <TemplateTargetDir>classes</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>SDOGreeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>JAXBGreeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage>
+ <Factory>TypesFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ TypesFactory factory = TypesFactory.INSTANCE;
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.interop</JavaPackage>
+ <Factory>InteropFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <!-- Type>
+ <TypeName>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
new file mode 100644
index 0000000000..36797fde57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/interop/src/main/resources/generate/interopgreeter.composite.vm
@@ -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:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="InteropGreeterService">
+
+ <!-- SDO factory classes -->
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+
+ <!-- Default binding test -->
+ <component name="SDODefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="JAXBDefaultGreeterServiceClient"/>
+ </component>
+
+ <component name="JAXBDefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="SDODefaultGreeterServiceComponent"/>
+ </component>
+
+ <component name="SDODefaultGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+ <!-- WS binding test -->
+ <component name="SDOWSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="JAXBWSGreeterServiceReference" promote="SDOWSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <service name="JAXBWSGreeterService" promote="JAXBWSGreeterServiceClient">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/jaxb#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="JAXBWSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="SDOWSGreeterServiceReference" promote="JAXBWSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <service name="SDOWSGreeterService" promote="SDOWSGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services/sdo#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="SDOWSGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/pom.xml
new file mode 100644
index 0000000000..a161bcf6ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/pom.xml
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest-databindings</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tuscany-itest-databindings-jaxb</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany JAXB Databinding Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <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/jaxws-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</packageName>
+ <wsdlDirectory>${project.build.directory}/classes/wsdl</wsdlDirectory>
+ <wsdlFiles>
+ <wsdlFile>Greeter.wsdl</wsdlFile>
+ </wsdlFiles>
+ <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
+ <verbose>true</verbose>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..8381a164ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/generate/generate.xml
@@ -0,0 +1,172 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+
+
+ <Template>
+ <TemplateName>GreeterService.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClient.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>DatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/jaxbdatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>Greeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.jaxbdatabinding.generated</JavaPackage>
+ <Factory>ObjectFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <!-- Type>
+ <TypeName>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ org.apache.tuscany.sca.itest.jaxbdatabinding.generated.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ ObjectFactory factory = new ObjectFactory();
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/greeter.composite b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/greeter.composite
new file mode 100644
index 0000000000..520a68e9b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/jaxbgen/src/main/resources/greeter.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:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ name="JAXBGreeterService">
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="JAXBGreeterServiceComponent"/>
+ </component>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="JAXBGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <!-- The greeter service -->
+ <service name="JAXBGreeterService" promote="JAXBGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ <reference>JAXBGreeterServiceComponent</reference>
+ </service>
+
+ <!-- Components used to implement the services -->
+ <component name="JAXBGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.jaxbdatabinding.GreeterServiceImpl" />
+ </component>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/pom.xml
new file mode 100644
index 0000000000..ac038180ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/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>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings</artifactId>
+ <name>Apache Tuscany SCA Databindings Integration Tests</name>
+ <version>0.90-incubating-SNAPSHOT</version>
+
+
+ <packaging>pom</packaging>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+ <modules>
+ <module>common</module>
+ <module>sdogen</module>
+ <module>jaxbgen</module>
+ <module>interop</module>
+ </modules>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/readme.html b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/readme.html
new file mode 100644
index 0000000000..24a44e4ed7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/readme.html
@@ -0,0 +1,157 @@
+<!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 SCA Integration Test Databindings</title>
+ <!-- LINK rel="stylesheet" href="ait.css" type="text/css" -->
+ <link rel="stylesheet" href="../../css/base.css" type="text/css">
+</head>
+
+<body>
+<h3>Tuscany SCA Integation Test Databindings </h3>
+
+<h4>Overview</h4>
+
+<p>
+This integration test tests the Tuscany SCA databinding implementation by passing various data structures
+across various bindings using the supported databindings. There are tests for the individual databindings
+which exercise various bindings with the same databinding at client and server ends of each binding. There
+is also an integration test which exercises the transformer chains by specifying different databindings at
+client and server ends of the binding.
+</p>
+<p>
+In doing this testing it is apparent that there is a lot of repetition in creating client, services, idl and
+type for each of the data types for each of the bindings for each of the databindings. To reduce the amount
+of effort required to maintain the tests as new types, bindings and databindings are added the test cases
+themselves are generated from configuration files.
+</p>
+
+<h4>Test Structure</h4>
+
+Databindings/Common - hold files common across all tests <br/>
+Databindings/Interop - test the transformer chains with combinations of databindings<br/>
+Databindings/sdogen and jaxbgen - test each databindings independently<br/>
+
+<h4>Test Generation</h4>
+<p>
+To reduce the amount of manual effort involved in building and maintaining tests cases the test cases
+themselves are generated at run time using a set of velocity templates. Each test module has a generate.xml
+file in the resources/generate directory which tells the generator what to do. The file looks like this.
+</p>
+<img src="config.png">
+<p>
+Each <Template> element describes a velocit template to use in the test. The generator process is to expand
+each velocity template provided with all of the types specified in the <InputFile> sections.
+</p>
+<p>
+Each <InputFile> element describes a schema file used in the test. It also contains a description of each
+data type that will be tested. The generator then arranges for the databinding being tested to generate
+appropriate Java classes to represent the type at runtime. The individual databinding tests use the following
+flow.
+</p>
+
+Create data object at client<br/>
+Client passes data object to server<br/>
+Server modifies data object<br/>
+Server returns modified data object to client<br/>
+Client tests that modified data object is as expected<br/>
+<p>
+Hence the CreateTypeCode, ModifyTypeCode and ResultComparison elements which contain the type specific code
+that is used in the tests.
+</p>
+
+<h4>The Common Directory</h4>
+<p>
+The common directory contains the information that is common across all of the tests. This includes the
+common velocity templates and the source for the generator that reads the config.xml for each test. Common
+also contains all of the data type schema as these are common across all tests. Each test pom is written so
+that the contents of the common project are expanded into the tests target directory before the test starts.
+In this way all of the common elements are available for the test generation phase and at test runtime.
+</p>
+
+<h4>Individual Databinding Tests</h4>
+<p>
+The individual databinding tests, for example, sdogen and jaxbgen, are mostly empty as their content is
+generated at runtime. The configuration and any test specific templates can be found in the resources/generate
+directory. Some files are hand crafted for each test and live in their static position in the tests directory
+structure.
+</p>
+<p>
+Each test uses the same scenario
+</p>
+<img src="databinding.png">
+<p>
+The interface exposed by the greeter service provides a greet method for each data type being tested, for
+example,
+</p>
+<code>
+PersonType greetPersonType(PersonType param);<br/>
+AttributeComplexType greetAttributeComplexType(AttributeComplexType param);<br/>
+AttributeReferenceComplexType greetAttributeReferenceComplexType(AttributeReferenceComplexType param);<br/>
+</code>
+<p>
+These methods are taken from the SDO databinding test and hence PersonType, AttributeComplexType, etc. will
+have been generated by the SDO static type generator.
+</p>
+<p>
+Hence this tests a single databinding across a variety of data types and a variety of bindings. New bindings
+be tested by extending the composite. Be datatypes can be tested by updating the confix.xml file.
+</p>
+<h4>Databinding Interoperability Tests</h4>
+<p>
+This test uses the generated client, services and types from the individual databinding tests. It does not
+regenerate them and you will see a dependency in the interop test pom on the other databinding tests. Is also
+has some generate elements because the composite file must currently have import statements for all of the
+SDO factories required during tested.
+</p>
+<p>
+The scenario used here is,
+</p>
+<img src="interop.png">
+<p>
+A chain of components is built up for each binding. Each component, drawn from the the inidividual databinding
+tests, tests the full range of datatypes. The client components are designed so that they can be chained together
+and so tranformations across different databindings is tests. The service component simply changes the data
+content and returns it as before.
+</p>
+<h4>Building And Running The Tests</h4>
+<p>
+The tests can be built by doing the following.
+</p>
+<code>
+cd sca/itest/databindings <br/>
+mvn
+</code>
+<p>
+The only modification to this process is required if a new input file is added to the tests suite. In this
+case you will need to edit the config.xml files as appropriate but run mvn twice. This may sound a little
+odd but currently the sdo test uses its pom file to generate the require SDO types. As the test is self
+generating the pom file will not be updated to include the new type file until the second time it's run. The
+aim is at some point to remove this feature from the pom.
+</p>
+
+
+</body>
+</html>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/pom.xml
new file mode 100644
index 0000000000..27b7fc66a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/pom.xml
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest-databindings</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tuscany-itest-databindings-sdo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SDO Databinding Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${project.build.directory}/classes/wsdl/Greeter.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${project.build.directory}/classes/xsd/Person.xsd</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.types</javaPackage>
+ </configuration>
+ <configuration>
+ <fileName>${project.build.directory}/classes/xsd/Interop.xsd</fileName>
+ <javaPackage>org.apache.tuscany.interop</javaPackage>
+ </configuration>
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/generate.xml b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/generate.xml
new file mode 100644
index 0000000000..5487b113e8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/generate.xml
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<tns:Generate xmlns:tns="http://www.apache.org/tuscany/generate"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.org/generate generate.xsd ">
+ <Template>
+ <TemplateName>pom.xml.vm</TemplateName>
+ <TemplateTargetDir>..</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>greeter.composite.vm</TemplateName>
+ <TemplateTargetDir>classes</TemplateTargetDir>
+ </Template>
+ <Template>
+ <TemplateName>GreeterService.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>GreeterServiceClientImpl.java.vm</TemplateName>
+ <TemplateTargetDir>../src/main/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>DatabindingTestCase.java.vm</TemplateName>
+ <TemplateTargetDir>../src/test/java/org/apache/tuscany/sca/itest/sdodatabinding</TemplateTargetDir>
+ <JavaPackage>org.apache.tuscany.sca.itest.sdodatabinding</JavaPackage>
+ </Template>
+ <Template>
+ <TemplateName>Greeter.wsdl.vm</TemplateName>
+ <TemplateTargetDir>classes/wsdl</TemplateTargetDir>
+ </Template>
+ <InputFile>
+ <FileName>Person.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.sca.itest.databinding.types</JavaPackage>
+ <Factory>TypesFactory</Factory>
+ <Namespace>http://apache.org/tuscany/sca/itest/databinding/types</Namespace>
+ <Prefix>p</Prefix>
+ <Type>
+ <TypeName>PersonType</TypeName>
+ <CreateTypeCode>
+ TypesFactory factory = TypesFactory.INSTANCE;
+ param = factory.createPersonType();
+ param.setFirstName("George");
+ param.setLastName("Doors");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setGreeting("Hello");
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertNotSame("greetedPerson.getGreeting() not set", "", result.getGreeting());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+ <InputFile>
+ <FileName>Interop.xsd</FileName>
+ <FilePath>xsd</FilePath>
+ <JavaPackage>org.apache.tuscany.interop</JavaPackage>
+ <Factory>InteropFactory</Factory>
+ <Namespace>http://www.apache.org/tuscany/interop</Namespace>
+ <Prefix>i</Prefix>
+ <!-- Type>
+ <TypeName>AnnotationComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAnnotationComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type-->
+ <Type>
+ <TypeName>AttributeComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ org.apache.tuscany.interop.AttributeType attrib = factory.createAttributeType();
+ attrib.setAttribute("SomeText");
+ param = factory.createAttributeComplexType();
+ param.setAttributeElement(attrib);
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.getAttributeElement().setAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getAttributeElement().getAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>AttributeReferenceComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createAttributeReferenceComplexType();
+
+ param.setReferencedAttribute("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setReferencedAttribute("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getReferencedAttribute());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithAbstractComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithAbstractComplexType();
+ param.setSimpleTypeWithAbstractExtensionElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithAbstractExtensionElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithAbstractExtensionElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>SimpleTypeWithNameComplexType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createSimpleTypeWithNameComplexType();
+ param.setSimpleTypeWithNameElement("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithNameElement("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithNameElement());
+ </ResultComparison>
+ </Type>
+ <Type>
+ <TypeName>ComplexTypeWithContentType</TypeName>
+ <CreateTypeCode>
+ InteropFactory factory = InteropFactory.INSTANCE;
+ param = factory.createComplexTypeWithContentType();
+ param.setSimpleTypeWithName("SomeText");
+ </CreateTypeCode>
+ <ModifyTypeCode>
+ param.setSimpleTypeWithName("SomeChangedText");;
+ </ModifyTypeCode>
+ <ResultComparison>
+ assertEquals("data not changed corretly", "SomeChangedText", result.getSimpleTypeWithName());
+ </ResultComparison>
+ </Type>
+ </InputFile>
+</tns:Generate>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
new file mode 100644
index 0000000000..9494d70f96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/greeter.composite.vm
@@ -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:wsdli="http://www.w3.org/2006/01/wsdl-instance"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ name="SDOGreeterService">
+
+ <!-- SDO factory classes -->
+ <dbsdo:import.sdo factory="org.apache.tuscany.sca.itest.databinding.services.ServicesFactory"/>
+ #foreach( $file in $fileList )
+ <dbsdo:import.sdo factory="$file.getJavaPackage().$file.getFactory()"/>
+ #end
+
+ <!-- Clients to test the services -->
+ <component name="DefaultGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ <reference name="greeterService" target="SDOGreeterServiceComponent"/>
+ </component>
+
+ <component name="WSGreeterServiceClient">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceClientImpl" />
+ </component>
+
+ <reference name="SDOGreeterServiceWSReference" promote="WSGreeterServiceClient/greeterService">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </reference>
+
+ <!-- The greeter service -->
+ <service name="SDOGreeterService" promote="SDOGreeterServiceComponent">
+ <interface.wsdl interface="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.interface(GreeterPortType)"/>
+ <binding.ws wsdlElement="http://apache.org/tuscany/sca/itest/databinding/services#wsdl.port(GreeterService/GreeterPort)"/>
+ </service>
+
+ <component name="SDOGreeterServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.sdodatabinding.GreeterServiceImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/pom.xml.vm b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/pom.xml.vm
new file mode 100644
index 0000000000..c057b80938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/databindings/sdogen/src/main/resources/generate/pom.xml.vm
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>tuscany-itest-databindings</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>tuscany-itest-databindings-sdo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SDO Databinding Integration Test</name>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <version>${pom.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${pom.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest-databindings-common</artifactId>
+ <version>${project.version}</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-test-source</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <mainClass>org.apache.tuscany.sca.itest.generate.Generate</mainClass>
+ <arguments>
+ <argument>${project.build.directory}</argument>
+ </arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>process-resources</phase>
+ <configuration>
+ <schemaFiles>
+ <configuration>
+ <fileName>${project.build.directory}/classes/wsdl/Greeter.wsdl</fileName>
+ <javaPackage>org.apache.tuscany.sca.itest.databinding.services</javaPackage>
+ </configuration>
+ #foreach( $file in $fileList )
+ <configuration>
+ <fileName>${project.build.directory}/classes/$file.getFilePath()/$file.getFileName()</fileName>
+ <javaPackage>$file.getJavaPackage()</javaPackage>
+ </configuration>
+ #end
+ </schemaFiles>
+ <noNotification>true</noNotification>
+ <noContainment>true</noContainment>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/pom.xml
new file mode 100644
index 0000000000..a72ef801d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/pom.xml
@@ -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.
+-->
+<project>
+ <parent>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-exceptions-crossBinding-ws</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Exception Handling cross bindings WS</name>
+ <!-- JAX-WS temporary only until java.net maven2 repo is ready-->
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <dependencies>
+ <!-- Required extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.idl</groupId>
+ <artifactId>tuscany-wsdl</artifactId>
+ <version>${scaKernelVersion}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>tuscany-axis2</artifactId>
+ <scope>runtime</scope>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <scope>runtime</scope>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <!-- End of Required extensions -->
+ <!-- sun's jax-ws -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- you will need to install these on your internal repo
+ https://jax-ws.dev.java.net/2.1/ download binary
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=http" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\http.jar"
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=resolver" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\resolver.jar"
+ -->
+ <!--
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>http</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>resolver</artifactId>
+ <version>2.1</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- ENDOF sun's jax-ws -->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java
new file mode 100644
index 0000000000..2c9b2d25cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.test.exceptions.impl;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+@DataType(name = "javax.xml.bind.JAXBElement")
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
new file mode 100644
index 0000000000..65751175fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.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.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(StockExceptionTestJAXB.class)
+public class StockExchangeJaxB implements StockExceptionTestJAXB {
+
+ /**
+ *
+ */
+ public StockExchangeJaxB() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer)
+ */
+ public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{
+
+ System.out.println("stockQuoteOffer '" + input + "'");
+
+ String symbol = input.getSymbol();
+ if ("IBM".equals(symbol)) {
+ input.setPrice(99.00F);
+ return input;
+
+ }
+ else if ("CLOSED".equals(input.getName())) {
+ throw new MarketClosedFault("TO LATE!", 3);
+
+ } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ }
+ ObjectFactory jaxbOjectFactory = new ObjectFactory();
+
+ InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault();
+
+ faultinfo.setOffer(input);
+
+ throw new InvalidSymbolFault_Exception("bad symbol", faultinfo);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
new file mode 100644
index 0000000000..5f65d293ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.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.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public interface StockTraderSDO {
+
+ StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ Object testNotDeclaredAtSourceTest();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..7d303887e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockexceptiontestservice.scatesttool.ScatesttoolFactory;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/**
+ *
+ */
+@Service(StockTraderSDO.class)
+public class StockTraderSDOImpl implements StockTraderSDO {
+
+ private StockExceptionTest exchangeJaxb;
+
+ /**
+ *
+ */
+
+ public StockTraderSDOImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Reference
+ public void setExchangeJaxb(StockExceptionTest exchangeJaxb) {
+ this.exchangeJaxb = exchangeJaxb;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest()
+ */
+ public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ stockOffer.setName("IBM");
+ stockOffer.setSymbol("IBM");
+ stockOffer.setPrice(100.00F); // offer to buy at max $100.00
+
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ return stockOfferAccepted;
+
+ }
+
+ public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException,
+ MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ // set up for a InvalidSymbolSDOException
+ stockOffer.setName("");
+ stockOffer.setSymbol("IBM0");
+
+ stockOffer.setPrice(11.0F); // offer to buy at max $100.00
+ exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ }
+
+ public void marketClosedSDOExceptionTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("CLOSED");
+ stockOffer.setSymbol("MBI");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+ stockOfferAccepted.getPrice(); // the price actually bought.
+ } catch (RemoteException e) {
+
+ e.printStackTrace();
+ } catch (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("testNotDeclaredAtSourceTest");
+ stockOffer.setSymbol("TNDAS");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..e9df6ba473
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.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.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+public class InvalidSymbolSDOException extends Exception {
+
+ public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault");
+
+ /**
+ *
+ */
+ public InvalidSymbolSDOException() {
+
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param cause
+ */
+ public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ // *** Below was hand added ... tooling needs to do this ***/
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..39b702afe3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.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.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ */
+public class MarketClosedSDOException extends Exception {
+ public static final QName FAULT_ELEMENT =
+ new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault");
+
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private int faultInfo;
+
+ /**
+ *
+ */
+ public MarketClosedSDOException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public MarketClosedSDOException(String message, int faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param cause
+ */
+ public MarketClosedSDOException(int faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public MarketClosedSDOException(String message, int faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean: int
+ */
+ public int getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..7b4b3a0f29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * StockExceptionTest.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+@DataType(name = "commonj.sdo.DataObject")
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0)
+ throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..f955ba093c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/ExceptionTest.composite
@@ -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"
+ xmlns:foo="http://foo"
+ name="ExceptionTest">
+
+ <include name="intracomposite" scdlLocation="intracomposite.composite"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..f385ebb47d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/intracomposite.composite
@@ -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.
+-->
+<composite name="intracomposite" xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
+ <dbsdo:import.sdo factory="stockexceptiontestservice.scatesttool.ScatesttoolFactory"/>
+
+ <service name="exchangeJaxbService">
+ <interface.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExceptionTestJAXB"/>
+ <binding.ws wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" wsdlLocation="http://scatesttool.stockexceptiontestservice wsdl/StockExceptionTest.wsdl"/>
+ <reference>exchangeJaxbComponent</reference>
+ </service>
+
+ <component name="exchangeJaxbComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB"/>
+ </component>
+
+ <component name="stockTraderSDOComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl"/>
+ <reference name="exchangeJaxb">stockTraderSDOReference</reference>
+ </component>
+
+ <reference name="stockTraderSDOReference">
+ <interface.java class="org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest"/>
+ <binding.ws wsdlElement="http://scatesttool.stockexceptiontestservice#wsdl.port(StockExceptionTestService/StockExceptionTestServiceSoapPort)" wsdlLocation="http://scatesttool.stockexceptiontestservice wsdl/StockExceptionTest.wsdl"/>
+ </reference>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..f5e716de94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
@@ -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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" 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="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <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="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..b4ed2b90cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/wsdl/StockExceptionTest.wsdl
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" 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="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <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="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/services/exchangeJaxbService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/main/resources/xsd/StockExceptionTest.xsd
@@ -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.
+ -->
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice"
+ >
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..ee4076394b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding-ws/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private StockTraderSDO stockTrader;
+
+ private CompositeContext context;
+
+ public void testTrading() {
+ try {
+ StockOffer sp = stockTrader.testTrading();
+ assertNotNull(sp);
+ assertEquals(99.00F, sp.getPrice());
+ assertEquals("IBM", sp.getSymbol());
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ fail(e + "");
+
+ }
+
+ }
+
+ public void testInvalidSymbolSDOException() {
+ try {
+ stockTrader.testInvalidSymbolSDOException();
+ fail("Expected InvalidSymbolSDOException");
+ } catch (InvalidSymbolSDOException e) {
+ InvalidSymbolFault isf = e.getFaultInfo();
+
+ assertNotNull(isf);
+ StockOffer sp = isf.getOffer();
+ assertEquals(11.00F, sp.getPrice());
+ assertEquals("IBM0", sp.getSymbol());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Expected InvalidSymbolSDOException" + e);
+
+ }
+ }
+
+ public void _testNotDeclaredAtSourceException() {
+
+ Object ret = stockTrader.testNotDeclaredAtSourceTest();
+
+ assertNotNull(ret);
+
+ assertEquals(TransformationException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("ExceptionTest.composite");
+
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ stockTrader = context.locateService(StockTraderSDO.class, "stockTraderSDOComponent");
+
+ assertNotNull(context);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/pom.xml
new file mode 100644
index 0000000000..3d4f03ffb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/pom.xml
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>sca-itest</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>iTest-exceptions-crossBinding</artifactId>
+ <packaging>jar</packaging>
+ <name>Test Suite Exception Handling cross bindings</name>
+ <!-- JAX-WS temporary only until java.net maven2 repo is ready-->
+ <repositories>
+ <repository>
+ <id>java.net</id>
+ <url>https://maven-repository.dev.java.net/nonav/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+ <dependencies>
+ <!-- Required extensions -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-sdo</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.services.databinding</groupId>
+ <artifactId>databinding-jaxb</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.extensions.axis2</groupId>
+ <artifactId>databinding-axiom</artifactId>
+ <version>${scaKernelVersion}</version>
+ </dependency>
+ <!-- End of Required extensions -->
+ <!-- sun's jax-ws -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- you will need to install these on your internal repo
+ https://jax-ws.dev.java.net/2.1/ download binary
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=http" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\http.jar"
+ mvn install:install-file "-DgroupId=com.sun.xml.ws" "-DartifactId=resolver" "-Dversion=2.1" "-Dpackaging=jar" "-Dfile=jaxws-ri\lib\resolver.jar"
+ -->
+ <!--
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>http</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>resolver</artifactId>
+ <version>2.1</version>
+ </dependency>
+-->
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <!-- ENDOF sun's jax-ws -->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <!-- Sun's JAX-WS Generation -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jaxws-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>wsimport</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
+ <verbose>true</verbose>
+ <packageName>org.apache.tuscany.sca.test.exceptions.impl.jaxb</packageName>
+ <keep>true</keep>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>javax.jws</groupId>
+ <artifactId>jsr181-api</artifactId>
+ <version>1.0-MR1</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <!-- SDO Generation -->
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>${sdo.version}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</schemaFile>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.extensions.axis2.plugins</groupId>
+ <artifactId>tuscany-plugin-wsdl2java</artifactId>
+ <version>${scaKernelVersion}</version>
+ <executions>
+ <execution>
+ <configuration>
+ <wsdlFile>${basedir}/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl</wsdlFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.java
new file mode 100644
index 0000000000..2c9b2d25cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExceptionTestJAXB.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.test.exceptions.impl;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ *
+ */
+@Remotable
+@DataType(name = "javax.xml.bind.JAXBElement")
+public interface StockExceptionTestJAXB extends StockExceptionTest {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.java
new file mode 100644
index 0000000000..65751175fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockExchangeJaxB.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.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.MarketClosedFault;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.ObjectFactory;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer;
+import org.apache.tuscany.sca.test.exceptions.impl.jaxb.TestNotDeclaredAtSourceFault;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(StockExceptionTestJAXB.class)
+public class StockExchangeJaxB implements StockExceptionTestJAXB {
+
+ /**
+ *
+ */
+ public StockExchangeJaxB() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockExceptionTest#stockQuoteOffer(org.apache.tuscany.sca.test.exceptions.impl.jaxb.StockOffer)
+ */
+ public StockOffer stockQuoteOffer(StockOffer input) throws InvalidSymbolFault_Exception, MarketClosedFault, TestNotDeclaredAtSourceFault{
+
+ System.out.println("stockQuoteOffer '" + input + "'");
+
+ String symbol = input.getSymbol();
+ if ("IBM".equals(symbol)) {
+ input.setPrice(99.00F);
+ return input;
+
+ }
+ else if ("CLOSED".equals(input.getName())) {
+ throw new MarketClosedFault("TO LATE!", 3);
+
+ } else if( "testNotDeclaredAtSourceTest".equals(input.getName())){
+
+ throw new TestNotDeclaredAtSourceFault("not declared", "fault info");
+
+ }
+ ObjectFactory jaxbOjectFactory = new ObjectFactory();
+
+ InvalidSymbolFault faultinfo = jaxbOjectFactory.createInvalidSymbolFault();
+
+ faultinfo.setOffer(input);
+
+ throw new InvalidSymbolFault_Exception("bad symbol", faultinfo);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.java
new file mode 100644
index 0000000000..5f65d293ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDO.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.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public interface StockTraderSDO {
+
+ StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+ Object testNotDeclaredAtSourceTest();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.java
new file mode 100644
index 0000000000..7d303887e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/StockTraderSDOImpl.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.exceptions.impl;
+
+import java.rmi.RemoteException;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.StockExceptionTest;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import stockexceptiontestservice.scatesttool.ScatesttoolFactory;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+/**
+ *
+ */
+@Service(StockTraderSDO.class)
+public class StockTraderSDOImpl implements StockTraderSDO {
+
+ private StockExceptionTest exchangeJaxb;
+
+ /**
+ *
+ */
+
+ public StockTraderSDOImpl() {
+ // TODO Auto-generated constructor stub
+ }
+
+ @Reference
+ public void setExchangeJaxb(StockExceptionTest exchangeJaxb) {
+ this.exchangeJaxb = exchangeJaxb;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO#tradingTest()
+ */
+ public StockOffer testTrading() throws RemoteException, InvalidSymbolSDOException, MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ stockOffer.setName("IBM");
+ stockOffer.setSymbol("IBM");
+ stockOffer.setPrice(100.00F); // offer to buy at max $100.00
+
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ return stockOfferAccepted;
+
+ }
+
+ public void testInvalidSymbolSDOException() throws RemoteException, InvalidSymbolSDOException,
+ MarketClosedSDOException {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+ // set up for a InvalidSymbolSDOException
+ stockOffer.setName("");
+ stockOffer.setSymbol("IBM0");
+
+ stockOffer.setPrice(11.0F); // offer to buy at max $100.00
+ exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ }
+
+ public void marketClosedSDOExceptionTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("CLOSED");
+ stockOffer.setSymbol("MBI");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ StockOffer stockOfferAccepted = exchangeJaxb.stockQuoteOffer(stockOffer);
+ stockOfferAccepted.getPrice(); // the price actually bought.
+ } catch (RemoteException e) {
+
+ e.printStackTrace();
+ } catch (InvalidSymbolSDOException e) {
+
+ e.printStackTrace();
+ } catch (MarketClosedSDOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+ public Object testNotDeclaredAtSourceTest() {
+ StockOffer stockOffer = ScatesttoolFactory.INSTANCE.createStockOffer();
+
+ // set up for a MarketClosedSDOException
+ stockOffer.setName("testNotDeclaredAtSourceTest");
+ stockOffer.setSymbol("TNDAS");
+ stockOffer.setPrice(Float.NaN); // offer to buy at max $100.00
+ try {
+ return exchangeJaxb.stockQuoteOffer(stockOffer);
+
+ } catch (Exception e) {
+ return e;
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.java
new file mode 100644
index 0000000000..e9df6ba473
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/InvalidSymbolSDOException.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.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+
+/**
+ *
+ */
+public class InvalidSymbolSDOException extends Exception {
+
+ public static final QName FAULT_ELEMENT = new QName("http://scatesttool.stockexceptiontestservice", "InvalidSymbolFault");
+
+ /**
+ *
+ */
+ public InvalidSymbolSDOException() {
+
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param cause
+ */
+ public InvalidSymbolSDOException(InvalidSymbolFault faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolSDOException(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+
+ }
+
+ // *** Below was hand added ... tooling needs to do this ***/
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.java
new file mode 100644
index 0000000000..39b702afe3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/MarketClosedSDOException.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.test.exceptions.sdohandgen;
+
+import javax.xml.namespace.QName;
+
+/**
+ *
+ */
+public class MarketClosedSDOException extends Exception {
+ public static final QName FAULT_ELEMENT =
+ new QName("http://scatesttool.stockexceptiontestservice", "MarketClosedFault");
+
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private int faultInfo;
+
+ /**
+ *
+ */
+ public MarketClosedSDOException() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public MarketClosedSDOException(String message, int faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param cause
+ */
+ public MarketClosedSDOException(int faultInfo, Throwable cause) {
+ super(cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public MarketClosedSDOException(String message, int faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean: int
+ */
+ public int getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.java
new file mode 100644
index 0000000000..7b4b3a0f29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/java/org/apache/tuscany/sca/test/exceptions/sdohandgen/StockExceptionTest.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.
+ */
+/**
+ * StockExceptionTest.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+package org.apache.tuscany.sca.test.exceptions.sdohandgen;
+
+import org.apache.tuscany.api.annotation.DataType;
+import org.osoa.sca.annotations.Remotable;
+
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.MarketClosedSDOException;
+
+/*
+ * StockExceptionTest java interface
+ */
+
+@Remotable
+@DataType(name = "commonj.sdo.DataObject")
+public interface StockExceptionTest {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ StockOffer stockQuoteOffer(StockOffer param0)
+ throws java.rmi.RemoteException, InvalidSymbolSDOException, MarketClosedSDOException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..f955ba093c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/ExceptionTest.composite
@@ -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"
+ xmlns:foo="http://foo"
+ name="ExceptionTest">
+
+ <include name="intracomposite" scdlLocation="intracomposite.composite"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..da10f8881e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/intracomposite.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"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" name="intracomposite">
+
+ <component name="stockTraderSDOComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDOImpl" />
+ <reference name="exchangeJaxb">exchangeJaxbComponent</reference>
+ </component>
+
+ <component name="exchangeJaxbComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.StockExchangeJaxB" />
+ </component>
+
+ <!-- Move to the end to verify the fix for TUSCANY-1165 -->
+ <dbsdo:import.sdo factory="stockexceptiontestservice.scatesttool.ScatesttoolFactory" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..f5e716de94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl.sdo/StockExceptionTest.wsdl
@@ -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.
+ -->
+<wsdl:definitions targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" 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="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+<!--
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+-->
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <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="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+<!--
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+-->
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl
new file mode 100644
index 0000000000..58367acac1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/wsdl/StockExceptionTest.wsdl
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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.stockexceptiontestservice" xmlns:impl="http://scatesttool.stockexceptiontestservice"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice" 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="StockExceptionTest">
+ <wsdl:types>
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="xsd:int" />
+
+ <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
+
+ </schema>
+ </wsdl:types>
+
+
+ <wsdl:message name="stockQuoteOfferRequest">
+ <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="stockQuoteOfferResponse">
+ <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="InvalidSymbolFault">
+ <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="MarketClosedFault">
+ <wsdl:part element="tns:MarketClosedFault" name="fault" />
+ </wsdl:message>
+
+ <wsdl:message name="TestNotDeclaredAtSourceFault">
+ <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
+ </wsdl:message>
+
+
+ <wsdl:portType name="StockExceptionTest">
+ <wsdl:operation name="stockQuoteOffer">
+ <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
+
+ <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
+
+ <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
+
+ <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
+
+ <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
+ </wsdl:operation>
+
+
+ </wsdl:portType>
+
+ <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
+ <!-- <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="stockQuoteOffer">
+ <wsdlsoap:operation soapAction="" />
+
+ <wsdl:input name="stockQuoteOfferRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+
+ <wsdl:output name="stockQuoteOfferResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+
+ <wsdl:fault name="InvalidSymbolException">
+ <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="MarketClosedException">
+ <wsdlsoap:fault name="MarketClosedException" use="literal" />
+ </wsdl:fault>
+
+ <wsdl:fault name="TestNotDeclaredAtSourceException">
+ <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
+ </wsdl:fault>
+
+
+
+ </wsdl:operation>
+
+
+ </wsdl:binding>
+
+ <wsdl:service name="StockExceptionTestService">
+ <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/StockExceptionTestService/services/StockExceptionTestService" />
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd
new file mode 100644
index 0000000000..9759647cfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/main/resources/xsd/StockExceptionTest.xsd
@@ -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.
+ -->
+ <schema targetNamespace="http://scatesttool.stockexceptiontestservice" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://scatesttool.stockexceptiontestservice"
+ >
+ <complexType name="StockOffer">
+ <sequence>
+ <element name="symbol" minOccurs="1" type="xsd:string" />
+ <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
+ <element name="name" minOccurs="0" type="xsd:string" />
+ </sequence>
+ </complexType>
+
+ <element name="stockQuoteOffer">
+ <complexType>
+ <sequence>
+ <element name="input" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="stockQuoteOfferResponse">
+ <complexType>
+ <sequence>
+ <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ <element name="offer" minOccurs="1" type="tns:StockOffer" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..c589c5611c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions-cross-binding/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.SCARuntime;
+import org.apache.tuscany.sca.test.exceptions.impl.StockTraderSDO;
+import org.apache.tuscany.sca.test.exceptions.sdohandgen.InvalidSymbolSDOException;
+import org.apache.tuscany.spi.databinding.TransformationException;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+import stockexceptiontestservice.scatesttool.InvalidSymbolFault;
+import stockexceptiontestservice.scatesttool.StockOffer;
+
+public class IntraCompositeTestCase extends TestCase {
+ private StockTraderSDO stockTrader;
+
+ private CompositeContext context;
+
+ public void testTrading() {
+ try {
+ StockOffer sp = stockTrader.testTrading();
+ assertNotNull(sp);
+ assertEquals(99.00F, sp.getPrice());
+ assertEquals("IBM", sp.getSymbol());
+ } catch (Exception e) {
+
+ e.printStackTrace();
+ fail(e + "");
+
+ }
+
+ }
+
+ public void testInvalidSymbolSDOException() {
+ try {
+ stockTrader.testInvalidSymbolSDOException();
+ fail("Expected InvalidSymbolSDOException");
+ } catch (InvalidSymbolSDOException e) {
+ InvalidSymbolFault isf = e.getFaultInfo();
+
+ assertNotNull(isf);
+ StockOffer sp = isf.getOffer();
+ assertEquals(11.00F, sp.getPrice());
+ assertEquals("IBM0", sp.getSymbol());
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Expected InvalidSymbolSDOException" + e);
+
+ }
+ }
+
+ public void testNotDeclaredAtSourceException() {
+
+ Object ret = stockTrader.testNotDeclaredAtSourceTest();
+
+ assertNotNull(ret);
+
+ assertEquals(TransformationException.class, ret.getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ SCARuntime.start("ExceptionTest.composite");
+
+ context = CurrentCompositeContext.getContext();
+ assertNotNull(context);
+ stockTrader = context.locateService(StockTraderSDO.class, "stockTraderSDOComponent");
+
+ assertNotNull(context);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ SCARuntime.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/pom.xml
new file mode 100644
index 0000000000..0bb10203c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-exceptions</artifactId>
+ <name>Apache Tuscany Exceptions Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.java
new file mode 100644
index 0000000000..e90289a07d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/Checked.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.exceptions;
+
+
+public class Checked extends Exception {
+
+ /**
+ *
+ */
+ public Checked() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public Checked(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public Checked(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public Checked(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.java
new file mode 100644
index 0000000000..0d14240513
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionHandler.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.sca.test.exceptions;
+
+public interface ExceptionHandler {
+
+ public abstract void testing();
+
+ public abstract Checked getTheBad();
+
+ public abstract String getTheGood();
+
+ public abstract UnChecked getTheUgly();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.java
new file mode 100644
index 0000000000..80073e7679
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/ExceptionThrower.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.exceptions;
+
+public interface ExceptionThrower {
+ public static final String SO_THEY_SAY = "All is good that ends good.";
+
+ public String theGood() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+ public String theBad() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+ public String theUgly() throws org.apache.tuscany.sca.test.exceptions.Checked;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.java
new file mode 100644
index 0000000000..1a439711dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/UnChecked.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.exceptions;
+
+public class UnChecked extends RuntimeException {
+
+ /**
+ *
+ */
+ public UnChecked() {
+
+ }
+
+ /**
+ * @param message
+ */
+ public UnChecked(String message) {
+ super(message);
+
+ }
+
+ /**
+ * @param cause
+ */
+ public UnChecked(Throwable cause) {
+ super(cause);
+
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public UnChecked(String message, Throwable cause) {
+ super(message, cause);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.java
new file mode 100644
index 0000000000..32a23c5e7d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionHandlerImpl.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.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionHandler;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.apache.tuscany.sca.test.exceptions.UnChecked;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ExceptionHandlerImpl implements ExceptionHandler {
+ static final String INIT = "INIT";
+
+ private ExceptionThrower exceptionThrower;
+
+ private String theGood;
+
+ private Checked theBad;
+
+ private UnChecked theUgly;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandler#testing()
+ */
+ public void testing() {
+
+ assert exceptionThrower != null : "'exceptionThrower' never wired";
+ String result = INIT;
+ try {
+ theGood = result = exceptionThrower.theGood();
+ assert result == ExceptionThrower.SO_THEY_SAY;
+ } catch (Throwable e) {
+ assert result == INIT;
+ assert false;
+ e.printStackTrace();
+ }
+
+ result = INIT;
+ try {
+ result = exceptionThrower.theBad();
+ // incredible
+ assert false : "Expected 'Check' Exception";
+
+ } catch (Checked e) {
+ // This is good...
+ assert result == INIT;
+ theBad = e;
+ } catch (Throwable t) {
+ // This is not so good.
+ t.printStackTrace();
+ assert result == INIT;
+ assert false : "Got wrong exception '" + t.getClass().getName();
+ }
+
+ result = INIT;
+ try {
+ result = exceptionThrower.theUgly();
+ // incredible
+ assert false : "Expected 'UnCheck' Exception";
+
+ } catch (Checked e) {
+ // This is not so good...
+ assert false : "Got wrong exception '" + e.getClass().getName();
+ assert result == INIT;
+ } catch (UnChecked e) {
+ theUgly = e;
+
+ } catch (Throwable t) {
+ // This is not good.
+ assert false;
+ assert result == INIT;
+
+ System.out.println(ExceptionThrower.SO_THEY_SAY + " " + INIT);
+ }
+
+ }
+
+ @Reference
+ public void setExceptionThrower(ExceptionThrower exceptionThrower) {
+ this.exceptionThrower = exceptionThrower;
+ }
+
+ public String getTheGood() {
+ return theGood;
+ }
+
+ public Checked getTheBad() {
+ return theBad;
+ }
+
+ public UnChecked getTheUgly() {
+ return theUgly;
+ }
+
+ public ExceptionThrower getExceptionThrower() {
+ return exceptionThrower;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.java
new file mode 100644
index 0000000000..c1b7c23d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/java/org/apache/tuscany/sca/test/exceptions/impl/ExceptionThrowerImpl.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.test.exceptions.impl;
+
+import org.apache.tuscany.sca.test.exceptions.Checked;
+import org.apache.tuscany.sca.test.exceptions.ExceptionThrower;
+import org.apache.tuscany.sca.test.exceptions.UnChecked;
+
+/**
+ * @author rineholt
+ *
+ */
+public class ExceptionThrowerImpl implements ExceptionThrower {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theBad()
+ */
+ public String theBad() throws Checked {
+
+ throw new Checked("theBad");
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theGood()
+ */
+ public String theGood() throws Checked {
+
+ return SO_THEY_SAY;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.exceptions.ExceptionThrower#theUgly()
+ */
+ public String theUgly() throws Checked {
+
+ throw new UnChecked("theUgly");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/ExceptionTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/ExceptionTest.composite
new file mode 100644
index 0000000000..ca3cc6eac2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/ExceptionTest.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"
+ xmlns:foo="http://foo"
+ targetNamespace = "http://foo"
+ name="ExceptionTest">
+
+ <include>foo:intracomposite</include>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/intracomposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/intracomposite.composite
new file mode 100644
index 0000000000..efe1c5e207
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/main/resources/intracomposite.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="intracomposite">
+
+ <component name="main">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionHandlerImpl"/>
+ <reference name="exceptionThrower" target="exceptionThrower"/>
+ </component>
+
+ <component name="exceptionThrower">
+ <implementation.java class="org.apache.tuscany.sca.test.exceptions.impl.ExceptionThrowerImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.java
new file mode 100644
index 0000000000..4f719a26c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/exceptions/src/test/java/org/apache/tuscany/sca/test/exceptions/IntraCompositeTestCase.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.exceptions;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class IntraCompositeTestCase extends TestCase {
+
+ private SCADomain domain;
+ private ExceptionHandler exceptionHandler;
+
+ public void testALL() {
+ exceptionHandler.testing();
+ assertEquals(ExceptionThrower.SO_THEY_SAY, exceptionHandler.getTheGood() );
+ assertNotNull(exceptionHandler.getTheBad());
+ assertEquals( Checked.class, exceptionHandler.getTheBad().getClass());
+ assertNotNull(exceptionHandler.getTheUgly());
+ assertEquals( UnChecked.class, exceptionHandler.getTheUgly().getClass());
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("ExceptionTest.composite");
+ exceptionHandler = domain.getService(ExceptionHandler.class, "main");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/pom.xml
new file mode 100644
index 0000000000..afa68d83b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-extended-api</artifactId>
+ <name>Apache Tuscany SCA Extended API Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+
+ <groupId>org.apache.tuscany.sca</groupId>
+
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+
+ <version>0.90-incubating-SNAPSHOT</version>
+
+ <scope>runtime</scope>
+
+ </dependency>
+
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/BasicService.java
new file mode 100644
index 0000000000..869565af17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/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.extended;
+
+public interface BasicService {
+
+ int negate(int theInt);
+ int delegateNegate(int theInt);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/MathService.java
new file mode 100644
index 0000000000..c54af93c05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/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.extended;
+
+public interface MathService {
+
+ int negate(int theInt);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.java
new file mode 100644
index 0000000000..523d238f2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/BasicServiceImpl.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.extended.impl;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.extended.BasicService;
+import org.apache.tuscany.sca.test.extended.MathService;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Service;
+
+@Service(BasicService.class)
+public class BasicServiceImpl implements BasicService {
+
+ @Context
+ protected ComponentContext context;
+
+ public int negate(int theInt) {
+ return -theInt;
+ }
+
+ public int delegateNegate(int theInt) {
+ SCADomain domain = SCADomain.connect("sca://local");
+ MathService service = domain.getService(MathService.class, "MathServiceComponent");
+ return service.negate(theInt);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/impl/MathServiceImpl.java
new file mode 100644
index 0000000000..ab4300a7dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/java/org/apache/tuscany/sca/test/extended/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.extended.impl;
+
+import org.apache.tuscany.sca.test.extended.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/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/BasicService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/BasicService.composite
new file mode 100644
index 0000000000..128b33b16f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/BasicService.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="BasicServiceComposite">
+
+ <component name="BasicServiceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.extended.impl.BasicServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/MathService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/main/resources/MathService.composite
new file mode 100644
index 0000000000..8e99d3da60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-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.extended.impl.MathServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.java
new file mode 100644
index 0000000000..2187a5afa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/extended-api/src/test/java/org/apache/tuscany/sca/test/extended/ServiceLocateTestCase.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.extended;
+
+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;
+import org.osoa.sca.ServiceRuntimeException;
+
+public class ServiceLocateTestCase {
+
+ private SCADomain domain;
+
+ @Test
+ public void unmanagedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ @Test
+ public void managedLocateService() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.delegateNegate(99));
+ }
+
+ @Test(expected = ServiceRuntimeException.class)
+ public void badComponentName() {
+ domain.getService(BasicService.class, "IvalidComponentName");
+ }
+
+ @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/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/pom.xml
new file mode 100644
index 0000000000..d14eba05db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-operation-overloading</artifactId>
+ <name>Apache Tuscany Operation Overloading Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.java
new file mode 100644
index 0000000000..f630f9904f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/OverloadASourceTarget.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.sca.test.opoverload;
+
+
+/**
+ *
+ */
+//@AllowsPassByReference
+public interface OverloadASourceTarget {
+ final String opName = "operationA:";
+
+ String operationA();
+
+ String operationA(int parm1);
+
+ String operationA(int parm1, String parm2);
+
+ String operationA(String parm1, int parm2);
+
+ String operationA(String string);
+
+ String[] operationAall();
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.java
new file mode 100644
index 0000000000..d0f78c409f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadASource.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.sca.test.opoverload.impl;
+
+import java.util.ArrayList;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadASource implements OverloadASourceTarget{
+ public OverloadASourceTarget overloadASourceTarget;
+ /**
+ *
+ */
+ public OverloadASource() {
+
+ }
+ /**
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String[] operationAall() {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ ArrayList<String> ret = new ArrayList<String>();
+ ret.add(overloadASourceTarget.operationA());
+ ret.add(overloadASourceTarget.operationA(11));
+ ret.add(overloadASourceTarget.operationA("eleven"));
+ ret.add(overloadASourceTarget.operationA(3,"three"));
+ ret.add(overloadASourceTarget.operationA("four",4));
+ return (String[]) ret.toArray(new String[ret.size()]);
+ }
+
+
+ /**
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String operationA() {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA();
+ }
+ /**
+ * @param parm1
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int)
+ */
+ public String operationA(int parm1) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1);
+ }
+ /**
+ * @param parm1
+ * @param parm2
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int, java.lang.String)
+ */
+ public String operationA(int parm1, String parm2) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1, parm2);
+ }
+ public String operationA(String string) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(string);
+ }
+ /**
+ * @param parm1
+ * @param parm2
+ * @return
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(java.lang.String, int)
+ */
+ public String operationA(String parm1, int parm2) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is null";
+ return overloadASourceTarget.operationA(parm1, parm2);
+ }
+
+ @Reference
+ public void setOverloadASourceTarget(OverloadASourceTarget overloadASourceTarget) {
+ assert overloadASourceTarget != null : "reference overloadASourceTarget is set tonull";
+ this.overloadASourceTarget = overloadASourceTarget;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.java
new file mode 100644
index 0000000000..e83952e573
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATarget.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.sca.test.opoverload.impl;
+
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+import org.osoa.sca.annotations.Service;
+
+/**
+ *
+ */
+@Service(OverloadASourceTarget.class)
+public class OverloadATarget implements OverloadASourceTarget {
+
+ /**
+ *
+ */
+ public OverloadATarget() {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int)
+ */
+ public String operationA(int parm1) {
+ final String ret = opName + parm1;
+ out(ret);
+ return ret;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA(int,
+ * java.lang.String)
+ */
+ public String operationA(int parm1, String parm2) {
+ final String ret = opName + parm1 + parm2;
+ out(ret);
+ return ret;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget#operationA()
+ */
+ public String operationA() {
+ out(opName);
+ return opName;
+
+ }
+
+ public String operationA(String parm1, int parm2) {
+ final String ret = opName + parm1 + parm2;
+ out(ret);
+ return ret;
+ }
+
+ public String operationA(String parm1) {
+ final String ret = opName + parm1;
+ out(ret);
+ return ret;
+ }
+
+ private void out(String msg) {
+
+ java.lang.System.out.println(msg);
+ }
+
+ public String[] operationAall() {
+ throw new IllegalArgumentException("not supported");
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/resources/OperationOverload.composite b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/resources/OperationOverload.composite
new file mode 100644
index 0000000000..cbf5aa2078
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/main/resources/OperationOverload.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"
+ targetNamespace="http://foo"
+ xmlns:foo="http://foo"
+ name="OperationOverload">
+
+ <component name="OverloadASourceComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadASource" />
+ <reference name="overloadASourceTarget" target="OverloadATargetComponent"/>
+ </component>
+
+ <component name="OverloadATargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.test.opoverload.impl.OverloadATarget" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.java
new file mode 100644
index 0000000000..3129b03ff3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/operation-overloading/src/test/java/org/apache/tuscany/sca/test/opoverload/impl/OverloadATestCase.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.opoverload.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.test.opoverload.OverloadASourceTarget;
+
+public class OverloadATestCase extends TestCase {
+
+ private SCADomain domain;
+ private OverloadASourceTarget overloadA;
+
+ public void testOperationAall() {
+ String[] result= overloadA.operationAall();
+ assertEquals(5, result.length);
+ assertEquals(OverloadASourceTarget.opName , result[0]);
+ assertEquals(OverloadASourceTarget.opName + 11, result[1]);
+ assertEquals(OverloadASourceTarget.opName + "eleven", result[2]);
+ assertEquals(OverloadASourceTarget.opName + 3 + "three", result[3]);
+ assertEquals(OverloadASourceTarget.opName + "four" + 4, result[4]);
+ }
+
+// public void testOperationAInt() {
+// String result= overloadA.operationA(29);
+// assertEquals(OverloadASourceTarget.opName + 29, result);
+// }
+//
+// public void testOperationAString() {
+// String result= overloadA.operationA("rick:-)");
+// assertEquals(OverloadASourceTarget.opName + "rick:-)", result);
+// }
+//
+// public void testOperationAIntString() {
+// String result= overloadA.operationA(123, "Tuscany");
+// assertEquals(OverloadASourceTarget.opName +123+ "Tuscany", result);
+// }
+//
+// public void testOperationStringInt() {
+// String result= overloadA.operationA("StringInt", 77);
+// assertEquals(OverloadASourceTarget.opName + "StringInt" + 77, result);
+// }
+//
+
+ @Override
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OperationOverload.composite");
+ overloadA = domain.getService(OverloadASourceTarget.class, "OverloadASourceComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/pom.xml
new file mode 100644
index 0000000000..052907d5fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Integration Tests</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>callback-api</module>
+ <module>callback-basic</module>
+ <module>callback-complex-type</module>
+ <module>callback-id</module>
+ <module>callback-set-callback</module>
+ <module>callback-set-conversation</module>
+ <module>contribution</module>
+ <module>conversations</module>
+ <module>databindings</module>
+ <module>exceptions</module>
+ <module>extended-api</module>
+ <module>operation-overloading</module>
+ <module>properties</module>
+ <module>recursive</module>
+ <!-- module>spec-api</module -->
+ <module>wsdl</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/properties/pom.xml
new file mode 100644
index 0000000000..c7b33e0a65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-itest</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-properties</artifactId>
+ <name>Apache Tuscany Properties Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.java
new file mode 100644
index 0000000000..667b854c10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponent.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;
+
+public interface ABCDComponent {
+ String getA();
+ String getB();
+ String getC();
+ String getD();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.java
new file mode 100644
index 0000000000..51d4d9b3cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABCDComponentImpl.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;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class ABCDComponentImpl implements ABCDComponent {
+ private ABComponent abComponent;
+ private CDComponent cdComponent;
+
+ @Reference
+ public void setAb(ABComponent component) {
+ this.abComponent = component;
+ }
+
+ @Reference
+ public void setCd(CDComponent component) {
+ this.cdComponent = component;
+ }
+
+ public String getA() {
+ return this.abComponent.getA();
+ }
+
+ public String getB() {
+ return this.abComponent.getB();
+ }
+
+ public String getC() {
+ return this.cdComponent.getC();
+ }
+
+ public String getD() {
+ return this.cdComponent.getD();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.java
new file mode 100644
index 0000000000..c33c140aec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponent.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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Remotable;
+@Remotable
+public interface ABComponent {
+
+ String getA();
+ String getB();
+ String getZ();
+ int getIntValue();
+ String getF();
+ Collection<String> getManyStringValues();
+ Collection<Integer> getManyIntegers();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.java
new file mode 100644
index 0000000000..b78d6380ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ABComponentImpl.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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class ABComponentImpl implements ABComponent {
+
+ private String aProperty;
+ private String bProperty;
+ private int intValue;
+ private Collection<String> manyStringValues;
+ private Collection<Integer> manyIntegerValues;
+ private String zProperty;
+ private String fProperty;
+
+ @Property(name="xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+ @Property(name="foobar")
+ public void setManyStringValues(final Collection<String> value) {
+ this.manyStringValues = value;
+ }
+
+ @Property(name="fooInts")
+ public void setManyIntegers(final Collection<Integer> value) {
+ this.manyIntegerValues = 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;
+ }
+
+ public Collection<String> getManyStringValues() {
+ return manyStringValues;
+ }
+
+ public Collection<Integer> getManyIntegers() {
+ return manyIntegerValues;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.java
new file mode 100644
index 0000000000..cd3046c62c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponent.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.itest;
+
+import java.util.Collection;
+
+public interface CDComponent {
+
+ String getC();
+ String getC2();
+ String getD();
+ String getNoSource();
+ String getFileProperty();
+ Collection<String> getManyValuesFileProperty();
+ int getOverrideValue();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.java
new file mode 100644
index 0000000000..aec71d30f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/CDComponentImpl.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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class CDComponentImpl implements CDComponent {
+
+ private String cProperty;
+ private String dProperty;
+ private String nosource;
+ private String fileProperty;
+ private Collection<String> manyValuesFileProperty;
+ 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(name="manyValuesFileProperty")
+ public void setFileManyValueProp(final Collection<String> values) {
+ this.manyValuesFileProperty = values;
+ }
+
+ @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;
+ }
+ public Collection<String> getManyValuesFileProperty() {
+ return this.manyValuesFileProperty;
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.java
new file mode 100644
index 0000000000..56820279d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/ComplexPropertyBean.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.itest;
+
+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 ) ? "" : intArray[0] + " - " + intArray[1] + " \n " ) +
+ ((doubleArray == null ) ? "" : doubleArray[0] + " - " + doubleArray[1] + " \n " ) +
+ ((stringArray == null ) ? "" : stringArray[0] + " - " + stringArray[1] + " \n " ) +
+ ((numberSetArray == null ) ? "" : 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/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideService.java
new file mode 100644
index 0000000000..116cdef48f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/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.itest;
+
+public interface OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/OverrideServiceImpl.java
new file mode 100644
index 0000000000..a36bb5e419
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/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.itest;
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.java
new file mode 100644
index 0000000000..a76f17bcad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponent.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.sca.itest;
+
+import java.util.Collection;
+
+
+public interface PropertyComponent {
+ public String getLocation();
+ public String getYear();
+ public ComplexPropertyBean getComplexPropertyOne();
+ public ComplexPropertyBean getComplexPropertyTwo();
+ public ComplexPropertyBean getComplexPropertyThree();
+ public Collection<ComplexPropertyBean> getComplexPropertyFour();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.java
new file mode 100644
index 0000000000..be99611dfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyComponentImpl.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.itest;
+
+import java.util.Collection;
+
+import org.osoa.sca.annotations.Property;
+
+public class PropertyComponentImpl implements PropertyComponent {
+ @Property
+ protected ComplexPropertyBean complexPropertyOne;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyTwo;
+
+ @Property
+ protected ComplexPropertyBean complexPropertyThree;
+
+ @Property
+ protected Collection<ComplexPropertyBean> complexPropertyFour;
+
+ @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() {
+ //System.out.println(complexPropertyOne);
+ return complexPropertyOne;
+ }
+
+ public ComplexPropertyBean getComplexPropertyTwo() {
+ //System.out.println(complexPropertyTwo);
+ return complexPropertyTwo;
+ }
+
+ public ComplexPropertyBean getComplexPropertyThree() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyThree;
+ }
+
+ public Collection<ComplexPropertyBean> getComplexPropertyFour() {
+ //System.out.println(complexPropertyThree);
+ return complexPropertyFour;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/PropertyService.java
new file mode 100644
index 0000000000..f20d295a06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/java/org/apache/tuscany/sca/itest/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.itest;
+
+public interface PropertyService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/OuterPropertyTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/OuterPropertyTest.composite
new file mode 100644
index 0000000000..43853d46a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/OuterPropertyTest.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="OuterPropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <component name="OuterComponent">
+ <implementation.composite name="foo:PropertyTest"/>
+ <property name="number">125</property>
+ <property name="complex" type="foo:MyComplexType">
+ <foo:MyComplexValue xsi:type="foo:MyComplexType" >
+ <foo:a>Overriden A</foo:a>
+ <foo:b>Overriden B</foo:b>
+ <foo:c>Overriden C</foo:c>
+ <foo:d>Overriden D</foo:d>
+ <foo:x>
+ <foo:y>Overriden Y</foo:y>
+ <foo:z>Overriden Z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/PropertyTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/PropertyTest.composite
new file mode 100644
index 0000000000..a678451c74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/PropertyTest.composite
@@ -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
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="PropertyTest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <service name="ProperterTestService" promote="ABComponent">
+ <interface.java interface="org.apache.tuscany.sca.itest.ABComponent"/>
+ </service>
+
+ <property name="number" type="xsd:int">1</property>
+ <property name="complex" type="foo:MyComplexType" >
+ <foo:MyComplexValue xsi: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>
+ <foo:y>y</foo:y>
+ <foo:z>z</foo:z>
+ </foo:x>
+ </foo:MyComplexValue>
+ </property>
+
+ <property name="moreComplex" type="foo:MyMoreComplexType">
+ <foo:MyMoreComplexValue xsi:type="foo:MyMoreComplexType">
+ <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:stringArray>TestString_1</foo:stringArray>
+ <foo:intArray>10</foo:intArray>
+ <foo:stringArray>TestString_2</foo:stringArray>
+ <foo:intArray>20</foo:intArray>
+ <foo:integerNumber>27</foo:integerNumber>
+ <foo:floatNumber>79.34</foo:floatNumber>
+ <foo:doubleNumber>184.52</foo:doubleNumber>
+ <foo:doubleArray>50.05</foo:doubleArray>
+ <foo:doubleArray>25.52</foo:doubleArray>
+ <foo:numberSet>
+ <foo:integerNumber>54</foo:integerNumber>
+ <foo:floatNumber>158.68</foo:floatNumber>
+ <foo:doubleNumber>369.04</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:MyMoreComplexValue>
+ </property>
+
+ <component name="ABCDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.ABCDComponentImpl"/>
+ <reference name="ab" target="ABComponent"/>
+ <reference name="cd" target="CDComponent"/>
+ </component>
+
+ <component name="ABComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.ABComponentImpl"/>
+ <property name="a" source="$complex/foo:MyComplexValue/foo:a"/>
+ <property name="b" source="$complex/foo:MyComplexValue/foo:b"/>
+ <property name="f" source="$complex/foo:MyComplexValue/foo:a">f</property>
+ <property name="xpath" source="$complex/foo:MyComplexValue/foo:x/*[local-name()='z']"/>
+ <property name="one" source="$number"/>
+ <property name="foobar" many="true">"Apache" "Tuscany" "Java SCA"</property>
+ <property name="fooInts" many="true">123 456 789</property>
+ </component>
+
+
+ <component name="CDComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.CDComponentImpl"/>
+ <property name="c" source="$complex/foo:MyComplexValue/foo:c"/>
+ <property name="d" source="$complex/foo:MyComplexValue/foo:d"/>
+ <property name="nosource">aValue</property>
+ <property name="fileProperty" file="fileProperty.txt"/>
+ <property name="manyValuesFileProperty" many="true" file="manyValuesFileProperty.txt"/>
+ <property name="nonFileProperty" file="fileProperty.txt" source="$complex/foo:MyComplexValue/foo:c"/>
+ <property name="two" source="$number">25</property>
+ </component>
+
+ <component name="PropertyComponent">
+ <implementation.java class="org.apache.tuscany.sca.itest.PropertyComponentImpl"/>
+ <property name="complexPropertyOne" source="$moreComplex"></property>
+ <property name="complexPropertyTwo">
+ <foo:MyAnotherComplexValue>
+ <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>
+ </foo:MyAnotherComplexValue>
+ </property>
+ <property name="complexPropertyThree" element="foo:PropertyThreeElement">
+ <foo:PropertyThreeElement>
+ <foo:stringArray>TestElementString_1</foo:stringArray>
+ <foo:stringArray>TestElementString_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>
+ </foo:PropertyThreeElement>
+ </property>
+ <property name="complexPropertyFour" element="foo:PropertyFourElement" many="true">
+ <foo:PropertyFourElement>
+ <foo:integerNumber>1</foo:integerNumber>
+ <foo:floatNumber>11.11</foo:floatNumber>
+ <foo:doubleNumber>111.111</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>11</foo:integerNumber>
+ <foo:floatNumber>1111.1111</foo:floatNumber>
+ <foo:doubleNumber>11111.11111</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ <foo:PropertyFourElement>
+ <foo:integerNumber>2</foo:integerNumber>
+ <foo:floatNumber>22.22</foo:floatNumber>
+ <foo:doubleNumber>222.222</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>22</foo:integerNumber>
+ <foo:floatNumber>2222.2222</foo:floatNumber>
+ <foo:doubleNumber>22222.22222</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ <foo:PropertyFourElement>
+ <foo:integerNumber>3</foo:integerNumber>
+ <foo:floatNumber>33.33</foo:floatNumber>
+ <foo:doubleNumber>333.333</foo:doubleNumber>
+ <foo:numberSet>
+ <foo:integerNumber>33</foo:integerNumber>
+ <foo:floatNumber>3333.3333</foo:floatNumber>
+ <foo:doubleNumber>33333.33333</foo:doubleNumber>
+ </foo:numberSet>
+ </foo:PropertyFourElement>
+ </property>
+ </component>
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/fileProperty.txt b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/fileProperty.txt
new file mode 100644
index 0000000000..0d3d9ead83
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/fileProperty.txt
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<filePropertyTest>fileValue</filePropertyTest>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/manyValuesFileProperty.txt b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/manyValuesFileProperty.txt
new file mode 100644
index 0000000000..450f397b30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/main/resources/manyValuesFileProperty.txt
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<manyFilePropertyValues>
+ "fileValueOne" "fileValueTwo" "fileValueThree" "fileValueFour"
+</manyFilePropertyValues>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.java
new file mode 100644
index 0000000000..b2ac537dec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/OuterPropertyTestCase.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.itest;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class OuterPropertyTestCase {
+
+ private static SCADomain domain;
+ private static ABComponent outerABService;
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("OuterPropertyTest.composite");
+ outerABService = domain.getService(ABComponent.class, "OuterComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+ @Test
+ public void testOverridenA() {
+ assertEquals("Overriden A", outerABService.getA());
+ }
+
+ @Test
+ public void testOverridenB() {
+ assertEquals("Overriden B", outerABService.getB());
+ }
+
+ @Test
+ public void testOverridenF() {
+ assertEquals("Overriden A", outerABService.getF());
+ }
+
+ @Test
+ public void testOverridenZ() {
+ assertEquals("Overriden Z", outerABService.getZ());
+ }
+
+ @Test
+ public void testOverridenIntValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(125, outerABService.getIntValue());
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = outerABService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = outerABService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
new file mode 100644
index 0000000000..4e9c76bf09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/properties/src/test/java/org/apache/tuscany/sca/itest/PropertyTestCase.java
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.itest;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.util.Iterator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class PropertyTestCase {
+ private static SCADomain domain;
+ private static ABComponent abService;
+ private static CDComponent cdService;
+ private static ABCDComponent abcdService;
+ private static PropertyComponent propertyService;
+
+ @Test
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ @Test
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ @Test
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ @Test
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+
+ @Test
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ @Test
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ @Test
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+ @Test
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ @Test
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ @Test
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ @Test
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ @Test
+ public void testManyValuesFileProperty() {
+ Iterator<String> iterator = cdService.getManyValuesFileProperty().iterator();
+ iterator.next();
+ String secondValue = iterator.next();
+ assertEquals(4, cdService.getManyValuesFileProperty().size());
+ assertEquals("fileValueTwo", secondValue);
+ }
+
+ @Test
+ public void testABCD() {
+ assertEquals("a", abcdService.getA());
+ assertEquals("b", abcdService.getB());
+ assertEquals("c", abcdService.getC());
+ assertEquals("d", abcdService.getD());
+ }
+
+ @Test
+ public void testDefaultProperty() {
+ assertEquals("RTP", propertyService.getLocation());
+ assertEquals("2006", propertyService.getYear());
+
+ }
+
+ @Test
+ public void testManySimpleStringValues() {
+ Iterator<String> iterator = abService.getManyStringValues().iterator();
+ assertEquals("Apache", iterator.next());
+ assertEquals("Tuscany", iterator.next());
+ assertEquals("Java SCA", iterator.next());
+ }
+
+ @Test
+ public void testManySimpleIntegerValues() {
+ Iterator<Integer> iterator = abService.getManyIntegers().iterator();
+ assertEquals(123, iterator.next().intValue());
+ assertEquals(456, iterator.next().intValue());
+ assertEquals(789, iterator.next().intValue());
+ }
+
+ @Test
+ public void testComplexPropertyOne() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyOne();
+ assertNotNull(propBean);
+ assertEquals("TestString_1", propBean.getStringArray()[0]);
+ assertEquals(2, propBean.numberSetArray[1].integerNumber);
+ }
+
+ @Test
+ public void testComplexPropertyTwo() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyTwo();
+ assertNotNull(propBean);
+ assertEquals(10, propBean.intArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ @Test
+ public void testComplexPropertyThree() {
+ ComplexPropertyBean propBean = propertyService.getComplexPropertyThree();
+ assertNotNull(propBean);
+ assertEquals("TestElementString_1", propBean.stringArray[0]);
+ assertEquals((float)22, propBean.numberSetArray[1].floatNumber);
+ }
+
+ @Test
+ public void testComplexPropertyFour() {
+ Object[] propBeanCollection = propertyService.getComplexPropertyFour().toArray();
+ assertNotNull(propBeanCollection);
+ assertEquals(1, ((ComplexPropertyBean)propBeanCollection[0]).getIntegerNumber());
+ assertEquals(222.222, ((ComplexPropertyBean)propBeanCollection[1]).getDoubleNumber());
+ assertEquals(33, ((ComplexPropertyBean)propBeanCollection[2]).getNumberSet().getIntegerNumber());
+ }
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("PropertyTest.composite");
+ abService = domain.getService(ABComponent.class, "ABComponent");
+ cdService = domain.getService(CDComponent.class, "CDComponent");
+ abcdService = domain.getService(ABCDComponent.class, "ABCDComponent");
+ propertyService =
+ domain.getService(PropertyComponent.class, "PropertyComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/pom.xml
new file mode 100644
index 0000000000..6354b3337d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-recursive</artifactId>
+ <name>Apache Tuscany SCA Recursive Composition Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/CompositeClient.java
new file mode 100644
index 0000000000..5edc305970
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/CompositeClient.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 composite;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple client program that invokes the components that we wired together.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain domain = SCADomain.newInstance("OuterComposite.composite");
+
+ Source source = domain.getService(Source.class, "SourceComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ Thread.sleep(500);
+
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Source.java
new file mode 100644
index 0000000000..d0efcc1df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Source.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 composite;
+
+public interface Source {
+
+ void clientMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceCallback.java
new file mode 100644
index 0000000000..baa95a8e39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceCallback.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 composite;
+
+public interface SourceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceImpl.java
new file mode 100644
index 0000000000..b9a0c7ff74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/SourceImpl.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 composite;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(Source.class)
+@Scope("COMPOSITE")
+public class SourceImpl implements Source, SourceCallback {
+
+ private Target targetReference;
+ private Target targetReference2;
+
+ @Reference
+ public void setTargetReference(Target target) {
+ this.targetReference = target;
+ }
+
+ @Reference
+ public void setTargetReference2(Target target) {
+ this.targetReference2 = target;
+ }
+
+ public void clientMethod(String arg) {
+ System.out.println("Source: " + arg + " -> Source.clientMethod");
+ targetReference.someMethod(arg + " -> Source.clientMethod");
+
+ System.out.println("Source: " + arg + " => Source.clientMethod2");
+ targetReference2.someMethod(arg + " => Source.clientMethod2");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Target.java
new file mode 100644
index 0000000000..9a8f68a7fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/Target.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 composite;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+
+
+@Callback(SourceCallback.class)
+public interface Target {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/TargetImpl.java
new file mode 100644
index 0000000000..86686e9233
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/composite/TargetImpl.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 composite;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(Target.class)
+@Scope("COMPOSITE")
+public class TargetImpl implements Target {
+
+ private SourceCallback sourceCallback;
+
+ @Callback
+ public void setSourceCallback(SourceCallback sourceCallback) {
+ this.sourceCallback = sourceCallback;
+ }
+
+ public void someMethod(String arg) {
+ System.out.println("Target: " + arg);
+ sourceCallback.receiveResult(arg + " -> Target.someMethod");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentAImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentAImpl.java
new file mode 100644
index 0000000000..f513949105
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentAImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Service1.class)
+public class ComponentAImpl implements Service1 {
+
+ @Reference(name = "Reference1", required = false)
+ protected Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentA");
+ }
+ return source + "-->ComponentA";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentCImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentCImpl.java
new file mode 100644
index 0000000000..586a9ee6a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentCImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Service(Service1.class)
+public class ComponentCImpl implements Service1 {
+
+ @Reference(name = "Reference1", required = false)
+ protected Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentC");
+ }
+ return source + "-->ComponentC";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentEImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentEImpl.java
new file mode 100644
index 0000000000..dbf2735aa7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentEImpl.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 sample;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentEImpl implements Service1 {
+ @Property(name = "Property1")
+ protected String prefix;
+
+ @Reference(name = "Reference1")
+ protected Service1 ref;
+
+ public String track(String source) {
+ return ref.track(source + "-->ComponentE");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentFImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentFImpl.java
new file mode 100644
index 0000000000..5e136e536c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/ComponentFImpl.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 sample;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ComponentFImpl implements Service1 {
+
+ private Service1 ref;
+
+ public String track(String source) {
+ if (ref != null) {
+ return ref.track(source + "-->ComponentF");
+ } else {
+ System.err.println("Reference1 is not wired...");
+ return source + "-->ComponentF";
+ }
+ }
+
+ @Reference(name = "Reference1")
+ public void setComponentA(Service1 ref) {
+ this.ref = ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/Service1.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/Service1.java
new file mode 100644
index 0000000000..81bdce79f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/java/sample/Service1.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 sample;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Service1 {
+ String track(String source);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite1.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite1.composite
new file mode 100644
index 0000000000..56fd7c621f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite1.composite
@@ -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.
+ -->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="Composite1">
+
+ <component name="ComponentA">
+ <implementation.java class="sample.ComponentAImpl"/>
+ </component>
+
+ <component name="ComponentB">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="sample:Composite3"/>
+
+ <!-- Wired to ComponentA -->
+ <reference name="Reference1" target="ComponentA"/>
+
+ <property name="Property1">ABC</property>
+ </component>
+
+ <!-- ComponentB.Service1 is promoted -->
+ <service name="Service1" promote="ComponentB/Service1" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite2.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite2.composite
new file mode 100644
index 0000000000..377f14bd4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite2.composite
@@ -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" targetNamespace="http://sample" xmlns:sample="http://sample"
+ name="Composite2">
+
+ <component name="ComponentC">
+ <implementation.java class="sample.ComponentCImpl" />
+
+ <!-- Wired to ComponentD.Service1 -->
+ <reference name="Reference1" target="ComponentD/Service1" />
+ </component>
+
+ <component name="ComponentD">
+ <!-- Implemented by Composite3 -->
+ <implementation.composite name="sample:Composite3" />
+
+ <!-- The property value is "XYZ" -->
+ <property name="Property1">XYZ</property>
+ </component>
+
+ <!-- ComponentD.Reference1 is promoted -->
+ <reference name="Reference1" promote="ComponentD/Reference1" />
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite3.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite3.composite
new file mode 100644
index 0000000000..6c81b28d1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/Composite3.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" targetNamespace="http://sample" xmlns:sample="http://sample"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Composite3">
+
+ <component name="ComponentE">
+ <implementation.java class="sample.ComponentEImpl" />
+ <reference name="Reference1" target="ComponentF/Service1" />
+
+ <!-- The property is from the composite Property1 -->
+ <property name="Property1" source="$Property1" />
+ </component>
+
+ <component name="ComponentF">
+ <implementation.java class="sample.ComponentFImpl" />
+ </component>
+
+ <service name="Service1" promote="ComponentE/Service1" />
+
+ <reference name="Reference1" promote="ComponentF/Reference1">
+ <!--
+ <binding.sca />
+ -->
+ </reference>
+
+ <property name="Property1" type="xsd:string">123</property>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite">
+
+ <service name="InnerSourceService" promote="InnerSourceComponent">
+ <interface.java interface="composite.Source"/>
+ </service>
+
+ <component name="InnerSourceComponent">
+ <implementation.java class="composite.SourceImpl"/>
+ </component>
+
+ <reference name="targetComponentRef" promote="InnerSourceComponent/targetReference">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+ <reference name="targetComponentRef2" promote="InnerSourceComponent/targetReference2">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/InnerComposite2.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://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite2">
+
+ <service name="InnerTargetService" promote="InnerTargetComponent">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </service>
+
+ <component name="InnerTargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/main/resources/OuterComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="OuterComposite">
+
+ <component name="SourceComponent">
+ <implementation.composite name="sample:InnerComposite"/>
+ <reference name="targetComponentRef" target="TargetComponent"/>
+ <reference name="targetComponentRef2" target="TargetComponent2/InnerTargetService"/>
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+ <component name="TargetComponent2">
+ <implementation.composite name="sample:InnerComposite2"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..f81b02faef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/composite/CompositeTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain domain;
+ private Source source;
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("OuterComposite.composite");
+ source = domain.getService(Source.class, "SourceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/sample/RecursiveCompositeTest.java b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/sample/RecursiveCompositeTest.java
new file mode 100644
index 0000000000..45f16b38c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/recursive/src/test/java/sample/RecursiveCompositeTest.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 sample;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class RecursiveCompositeTest extends TestCase {
+
+ private SCADomain domain;
+ private Service1 tracker, tracker2;
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("http://localhost", "/", "Composite1.composite", "Composite2.composite");
+ tracker = domain.getService(Service1.class, "ComponentC");
+ tracker2 = domain.getService(Service1.class, "ComponentB");
+
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ System.out.println(tracker.track("Client"));
+ System.out.println(tracker2.track("Client"));
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/pom.xml
new file mode 100644
index 0000000000..fbccd0a9a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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.0-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-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.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/BasicService.java
new file mode 100644
index 0000000000..65e85e5db6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MathService.java
new file mode 100644
index 0000000000..db367225ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java
new file mode 100644
index 0000000000..7fe9fa4909
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java
new file mode 100644
index 0000000000..a381fc62dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java
new file mode 100644
index 0000000000..fbb2161df3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java
new file mode 100644
index 0000000000..98490c4e3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java
new file mode 100644
index 0000000000..6a4cfc1f79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java
new file mode 100644
index 0000000000..c2d107ef28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/BasicServiceImpl.java
new file mode 100644
index 0000000000..ea0b59528f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MathServiceImpl.java
new file mode 100644
index 0000000000..8b52a5fe31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/BasicService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/BasicService.composite
new file mode 100644
index 0000000000..d650c8ab42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/CompositeTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/CompositeTest.composite
new file mode 100644
index 0000000000..c01c6845e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/MathService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/MathService.composite
new file mode 100644
index 0000000000..59f8fa6981
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myListService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myListService.composite
new file mode 100644
index 0000000000..819c399a7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInComposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInComposite.composite
new file mode 100644
index 0000000000..38e58f31a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myServiceInRecursive.composite
new file mode 100644
index 0000000000..4b54f430b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleService.composite
new file mode 100644
index 0000000000..2281149b19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive.composite
new file mode 100644
index 0000000000..82b022b4d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/mySimpleServiceInRecursive2.composite
new file mode 100644
index 0000000000..0547ac977f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalService.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalService.composite
new file mode 100644
index 0000000000..eb00da6c76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInComposite.composite
new file mode 100644
index 0000000000..87ca0641af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInCompositeForReferenceOverride.composite
new file mode 100644
index 0000000000..9354da4d9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursive.composite
new file mode 100644
index 0000000000..b5083feaa6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myTotalServiceInRecursiveForReferenceOverride.composite
new file mode 100644
index 0000000000..b1b47530a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myservice.composite b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/main/resources/myservice.composite
new file mode 100644
index 0000000000..a4f57a58b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.java
new file mode 100644
index 0000000000..3853b1ff85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentContextTestCase.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.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
+ public void simpleLocate() {
+ BasicService service = domain.getService(BasicService.class, "BasicServiceComponent");
+ assertEquals(-99, service.negate(99));
+ }
+
+ @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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceListTestCaseFIXME.java
new file mode 100644
index 0000000000..a39cbbbbca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentServiceReferenceTestCase.java
new file mode 100644
index 0000000000..b5c6a0d7b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/ComponentTestCase.java
new file mode 100644
index 0000000000..d136530412
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneService2LevelTestCaseFIXME.java
new file mode 100644
index 0000000000..38a98e01e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeOneServiceTestCase.java
new file mode 100644
index 0000000000..c29e9e72b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceForRefOverrideTestCase.java
new file mode 100644
index 0000000000..eb846ddb71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeServiceReferenceTestCase.java
new file mode 100644
index 0000000000..60ee8b2011
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/spec-api/src/test/java/org/apache/tuscany/sca/test/spec/CompositeTestCase.java
new file mode 100644
index 0000000000..d9c2a73f7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/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/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/pom.xml
new file mode 100644
index 0000000000..f454e661d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/pom.xml
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-itest-wsdl</artifactId>
+ <name>Apache Tuscany WSDL Integration Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <scope>compile</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-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AccountService.wsdl</schemaFile>
+ <javaPackage>com.bigbank.account</javaPackage>
+ <prefix>Account</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..265b11f7dd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataService.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 bigbank.account.services.accountdata;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@AllowsPassByReference
+public interface AccountDataService {
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0*
+ * @param param1*
+ * @param param2
+ */
+ public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param9*
+ * @param param10*
+ * @param param11
+ */
+ public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11)
+ throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0
+ */
+ public com.bigbank.account.AccountLog getAccountLog(int param0) throws java.rmi.RemoteException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..1e87899b01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountDataServiceImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Service;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CustomerProfileData getCustomerProfile(String logonID) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int customerID) {
+
+ return null;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData customerProfile, boolean createSavings, boolean createCheckings)
+ throws RemoteException {
+ CustomerProfileData data = AccountFactory.INSTANCE.createCustomerProfileData();
+ data.setLoginID(customerProfile.getLoginID());
+ data.setAddress(customerProfile.getAddress());
+ data.setEmail(customerProfile.getEmail());
+ data.setFirstName(customerProfile.getFirstName());
+ data.setId(customerProfile.getId());
+ data.setLastName(customerProfile.getLastName());
+ data.setPassword(customerProfile.getPassword());
+ return data;
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary stock) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(final int customerID) throws RemoteException {
+ throw new RemoteException("This method should not be called");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.java
new file mode 100644
index 0000000000..694227d7fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/AccountServiceClientImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class AccountServiceClientImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.java
new file mode 100644
index 0000000000..462a718c44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2aImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component2aImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.java
new file mode 100644
index 0000000000..17dbc27060
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component2bImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component2bImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.java
new file mode 100644
index 0000000000..90bf276834
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3aImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component3aImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.java
new file mode 100644
index 0000000000..b76ef600e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/Component3bImpl.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+import org.osoa.sca.annotations.Reference;
+
+import com.bigbank.account.AccountLog;
+import com.bigbank.account.AccountReport;
+import com.bigbank.account.CustomerProfileData;
+import com.bigbank.account.StockSummary;
+
+public class Component3bImpl implements AccountDataService {
+
+ AccountDataService accountService;
+
+ @Reference
+ public void setAccountService(AccountDataService accountService) {
+ this.accountService = accountService;
+ }
+
+ public CustomerProfileData createAccount(CustomerProfileData param9, boolean param10, boolean param11) throws RemoteException {
+ return accountService.createAccount(param9, param10, param11);
+ }
+
+ public float deposit(String param6, float param7) throws RemoteException {
+
+ return 0;
+ }
+
+ public AccountLog getAccountLog(int param0) throws RemoteException {
+
+ return null;
+ }
+
+ public AccountReport getAccountReport(int param19) throws RemoteException {
+
+ return null;
+ }
+
+ public CustomerProfileData getCustomerProfile(String param4) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary purchaseStock(int param0, StockSummary parm1) throws RemoteException {
+
+ return null;
+ }
+
+ public StockSummary sellStock(int param13, int param14) throws RemoteException {
+
+ return null;
+ }
+
+ public float withdraw(String param16, float param17) throws RemoteException {
+
+ return 0;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.java
new file mode 100644
index 0000000000..e747eb041f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/bigbank/account/services/accountdata/CustomerIdService.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 bigbank.account.services.accountdata;
+
+import java.rmi.RemoteException;
+
+/**
+ * This interface allows access to a customer's id from the data service.
+ */
+public interface CustomerIdService {
+
+ /*
+ * Return -1 if purchaseLotNumber not found
+ */
+ public int getCustomerIdByPurchaseLotNumber(int purchaseLotNumber) throws RemoteException;
+
+ /*
+ * Return -1 if account not found
+ */
+ public int getCustomerIdByAccount(String account) throws RemoteException;
+
+ // TODO (isilval) Fix this !!!
+ // Apparently, configuration can't deal with extends so I am adding the contents of AccountDataService here
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param0*
+ * @param param1*
+ * @param param2
+ */
+ public com.bigbank.account.StockSummary purchaseStock(int param0, com.bigbank.account.StockSummary parm1) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param4
+ */
+ public com.bigbank.account.CustomerProfileData getCustomerProfile(java.lang.String param4) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param6*
+ * @param param7
+ */
+ public float deposit(java.lang.String param6, float param7) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param9*
+ * @param param10*
+ * @param param11
+ */
+ public com.bigbank.account.CustomerProfileData createAccount(com.bigbank.account.CustomerProfileData param9, boolean param10, boolean param11)
+ throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param13*
+ * @param param14
+ */
+ public com.bigbank.account.StockSummary sellStock(int param13, int param14) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param16*
+ * @param param17
+ */
+ public float withdraw(java.lang.String param16, float param17) throws java.rmi.RemoteException;
+
+ /**
+ * Auto generated method signatures
+ *
+ * @param param19
+ */
+ public com.bigbank.account.AccountReport getAccountReport(int param19) throws java.rmi.RemoteException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..c9076ebba6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/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 "Hi " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..bd527ff8e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldService.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.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+@Service
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..d706517b76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/helloworld/HelloWorldServiceComponent.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 helloworld;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+@Scope("COMPOSITE")
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.java
new file mode 100644
index 0000000000..9d147dc013
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2aImpl.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.itest;
+
+import helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component2aImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.java
new file mode 100644
index 0000000000..7556e02b36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component2bImpl.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 helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component2bImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.java
new file mode 100644
index 0000000000..e7031ff41c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3aImpl.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 helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component3aImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.java
new file mode 100644
index 0000000000..7a049ed7b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/java/org/apache/tuscany/sca/itest/Component3bImpl.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 helloworld.HelloWorldService;
+
+import org.osoa.sca.annotations.Reference;
+
+public class Component3bImpl implements HelloWorldService {
+
+ private HelloWorldService comp;
+
+ @Reference
+ public void setComp(HelloWorldService comp) {
+ this.comp = comp;
+ }
+
+ public String getGreetings(String s) {
+ return comp.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/SDOWSDLTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/SDOWSDLTest.composite
new file mode 100644
index 0000000000..3e11cf67de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/SDOWSDLTest.composite
@@ -0,0 +1,344 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="SDOWSDLTest">
+
+ <dbsdo:import.sdo xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ factory="com.bigbank.account.AccountFactory" />
+
+ <service name="AccountService1a2a3a4a" promote="Component2a3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2a3a4a"/>
+ </service>
+ <service name="AccountService1a2a3a4b" promote="Component2a3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2a3a4b"/>
+ </service>
+ <service name="AccountService1a2a3b4a" promote="Component2a3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2a3b4a"/>
+ </service>
+ <service name="AccountService1a2a3b4b" promote="Component2a3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2a3b4b"/>
+ </service>
+ <service name="AccountService1a2b3a4a" promote="Component2b3a4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2b3a4a"/>
+ </service>
+ <service name="AccountService1a2b3a4b" promote="Component2b3a4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2b3a4b"/>
+ </service>
+ <service name="AccountService1a2b3b4a" promote="Component2b3b4a">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2b3b4a"/>
+ </service>
+ <service name="AccountService1a2b3b4b" promote="Component2b3b4b">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1a2b3b4b"/>
+ </service>
+ <service name="AccountService1b2a3a4a" promote="Component2a3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2a3a4a"/>
+ </service>
+ <service name="AccountService1b2a3a4b" promote="Component2a3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2a3a4b"/>
+ </service>
+ <service name="AccountService1b2a3b4a" promote="Component2a3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2a3b4a"/>
+ </service>
+ <service name="AccountService1b2a3b4b" promote="Component2a3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2a3b4b"/>
+ </service>
+ <service name="AccountService1b2b3a4a" promote="Component2b3a4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2b3a4a"/>
+ </service>
+ <service name="AccountService1b2b3a4b" promote="Component2b3a4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2b3a4b"/>
+ </service>
+ <service name="AccountService1b2b3b4a" promote="Component2b3b4a">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2b3b4a"/>
+ </service>
+ <service name="AccountService1b2b3b4b" promote="Component2b3b4b">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2aImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4a"/>
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3a4b"/>
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4a"/>
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component2bImpl" />
+ <reference name="accountService" target="Component3b4b"/>
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3aImpl" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.Component3bImpl" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/accountService">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"/>
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService" />
+ </reference>
+
+ <!-- target service -->
+
+ <service name="AccountService" promote="AccountServiceComponent">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)" uri="../AccountService"/>
+ </service>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.services.accountdata.AccountDataServiceImpl" />
+ </component>
+
+ <!-- test client -->
+
+ <component name="AccountServiceClient">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="AccountServiceRef" promote="AccountServiceClient/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"/>
+ </reference>
+
+ <!-- clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl"/>
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="bigbank.account.services.accountdata.AccountServiceClientImpl" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/accountService">
+ <interface.java interface="bigbank.account.services.accountdata.AccountDataService" />
+ <binding.ws wsdlElement="http://www.bigbank.com/account#wsdl.endpoint(AccountService/AccountServiceSOAP)"
+ uri="http://localhost:8080/AccountService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/WSDLTest.composite b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/WSDLTest.composite
new file mode 100644
index 0000000000..96a5a62d20
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/WSDLTest.composite
@@ -0,0 +1,371 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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="WSDLTest">
+
+ <service name="HelloWorldService1a2a3a4a" promote="Component2a3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3a4b" promote="Component2a3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4a" promote="Component2a3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2a3b4b" promote="Component2a3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4a" promote="Component2b3a4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3a4b" promote="Component2b3a4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4a" promote="Component2b3b4a" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1a2b3b4b" promote="Component2b3b4b" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1a2b3b4b"/>
+ </service>
+
+ <service name="HelloWorldService1b2a3a4a" promote="Component2a3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2a3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3a4b" promote="Component2a3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2a3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4a" promote="Component2a3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2a3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2a3b4b" promote="Component2a3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2a3b4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4a" promote="Component2b3a4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2b3a4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3a4b" promote="Component2b3a4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2b3a4b"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4a" promote="Component2b3b4a" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2b3b4a"/>
+ </service>
+ <service name="HelloWorldService1b2b3b4b" promote="Component2b3b4b" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldService1b2b3b4b"/>
+ </service>
+
+ <component name="Component2a3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2a3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2a3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2a3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2aImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component2b3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4a" />
+ </component>
+ <component name="Component2b3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3a4b" />
+ </component>
+ <component name="Component2b3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4a" />
+ </component>
+ <component name="Component2b3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component2bImpl"/>
+ <reference name="comp" target="Component3b4b" />
+ </component>
+
+ <component name="Component3a4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4aRef" promote="Component3a4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3a4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3aImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3a4bRef" promote="Component3a4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4a">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4aRef" promote="Component3b4a/comp" >
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldWebService" />
+ </reference>
+
+ <component name="Component3b4b">
+ <implementation.java class="org.apache.tuscany.sca.itest.Component3bImpl"/>
+ <reference name="comp" />
+ </component>
+ <reference name="Component3b4bRef" promote="Component3b4b/comp" >
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldWebService" />
+ </reference>
+
+
+<!-- the servive -->
+
+ <service name="HelloWorldWebService" promote="HelloWorldServiceComponent" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)" uri="../HelloWorldWebService"/>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+<!-- the clients -->
+
+ <component name="Client1a2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4a" promote="Client1a2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2a3a4a" />
+ </reference>
+
+ <component name="Client1a2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3a4b" promote="Client1a2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2a3a4b" />
+ </reference>
+
+ <component name="Client1a2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4a" promote="Client1a2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2a3b4a" />
+ </reference>
+
+ <component name="Client1a2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2a3b4b" promote="Client1a2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2a3b4b" />
+ </reference>
+
+ <component name="Client1a2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4a" promote="Client1a2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2b3a4a" />
+ </reference>
+
+ <component name="Client1a2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3a4b" promote="Client1a2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2b3a4b" />
+ </reference>
+
+ <component name="Client1a2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4a" promote="Client1a2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2b3b4a" />
+ </reference>
+
+ <component name="Client1a2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1a2b3b4b" promote="Client1a2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1a2b3b4b" />
+ </reference>
+
+ <component name="Client1b2a3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4a" promote="Client1b2a3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2a3a4a" />
+ </reference>
+
+ <component name="Client1b2a3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3a4b" promote="Client1b2a3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2a3a4b" />
+ </reference>
+
+ <component name="Client1b2a3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4a" promote="Client1b2a3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2a3b4a" />
+ </reference>
+
+ <component name="Client1b2a3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2a3b4b" promote="Client1b2a3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2a3b4b" />
+ </reference>
+
+ <component name="Client1b2b3a4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4a" promote="Client1b2b3a4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2b3a4a" />
+ </reference>
+
+ <component name="Client1b2b3a4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3a4b" promote="Client1b2b3a4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)"/>
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2b3a4b" />
+ </reference>
+
+ <component name="Client1b2b3b4a">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4a" promote="Client1b2b3b4a/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2b3b4a" />
+ </reference>
+
+ <component name="Client1b2b3b4b">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ <reference name="helloWorldService" />
+ </component>
+
+ <reference name="ClientRef1b2b3b4b" promote="Client1b2b3b4b/helloWorldService" >
+ <!-- interface.java interface="helloworld.HelloWorldService" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService1b2b3b4b" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType
new file mode 100644
index 0000000000..aa91a713d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component2bImpl.componentType
@@ -0,0 +1,29 @@
+<?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="Component2Service">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType
new file mode 100644
index 0000000000..57b1d66e9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/bigbank/account/services/accountdata/Component3bImpl.componentType
@@ -0,0 +1,29 @@
+<?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="Component3Service">
+ <interface.wsdl interface="http://www.bigbank.com/account#wsdl.interface(AccountService)"
+ wsdli:wsdlLocation="http://www.bigbank.com/account wsdl/AccountService.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType
new file mode 100644
index 0000000000..de8307b8c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component2bImpl.componentType
@@ -0,0 +1,29 @@
+<?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="Component2Service">
+ <!-- interface.java interface="org.apache.tuscany.sca.itest.Component" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType
new file mode 100644
index 0000000000..de8307b8c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/org/apache/tuscany/sca/itest/Component3bImpl.componentType
@@ -0,0 +1,29 @@
+<?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="Component2Service">
+ <!-- interface.java interface="org.apache.tuscany.sca.itest.Component" / -->
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
new file mode 100644
index 0000000000..8802f91b9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/AccountService.wsdl
@@ -0,0 +1,467 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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: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:complexType name="DataGraphRoot">
+ <xsd:sequence>
+ <xsd:element name="customerProfileData" type="account:CustomerProfileData" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockSummaries" type="account:StockSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountSummaries" type="account:AccountSummary" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="StockLogEntries" type="account:StockLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ <xsd:element name="AccountLogEntries" type="account:AccountLogEntry" maxOccurs="unbounded" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>-->
+
+
+ <xsd:element name="getAccountReport">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountReportResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountReport"
+ type="account:AccountReport" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountReport">
+ <xsd:sequence>
+ <xsd:element name="accountSummaries"
+ type="account:AccountSummary" maxOccurs="unbounded" />
+ <xsd:element name="stockSummaries"
+ type="account:StockSummary" 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:complexType name="StockSummary">
+ <!-- xsd:attribute name="id" type="xsd:int" / -->
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ <!-- unique id for this purchase -->
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="purchaseDate" type="xsd:dateTime" />
+ <xsd:attribute name="purchasePrice" type="xsd:float" />
+ <xsd:attribute name="currentPrice" type="xsd:float" />
+ <xsd:attribute name="company" type="xsd:string" />
+ <xsd:attribute name="highPrice" type="xsd:float" />
+ <xsd:attribute name="lowPrice" type="xsd:float" />
+
+ </xsd:complexType>
+
+ <!-- Profile in data base -->
+ <xsd:element name="getCustomerProfile">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="loginID" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="CustomerProfileData">
+ <xsd:sequence>
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ <xsd:element name="address" type="xsd:string" />
+ <xsd:element name="email" type="xsd:string" />
+ <xsd:element name="loginID" type="xsd:string" />
+ <xsd:element name="password" type="xsd:string" />
+ <xsd:element name="id" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:element name="getCustomerProfileResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="withdraw">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="withdrawResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="deposit">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountNumber"
+ type="xsd:string" />
+ <xsd:element name="amount" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="depositResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="balance" type="xsd:float" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="id" type="xsd:int" />
+ <xsd:element name="stock" type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="purchaseStockResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseSummary"
+ type="account:StockSummary" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+
+
+ <xsd:element name="sellStock">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="purchaseLotNumber"
+ type="xsd:int" /><!-- unique id for this purchase -->
+ <xsd:element name="quantity" type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="createAccount">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ <xsd:element name="createSavings"
+ type="xsd:boolean" />
+ <xsd:element name="createCheckings"
+ type="xsd:boolean" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="createAccountResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerProfile"
+ type="account:CustomerProfileData" />
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:element>
+
+ <xsd:element name="getAccountLog">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="customerID"
+ type="xsd:int" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="getAccountLogResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="accountLog"
+ type="account:AccountLog" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="AccountLog">
+ <xsd:sequence>
+ <xsd:element name="accountLogEntries"
+ type="account:AccountLogEntry" maxOccurs="unbounded" />
+ <xsd:element name="stockLogEntries"
+ type="account:StockLogEntry" maxOccurs="unbounded" />
+
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="AccountLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="accountNumber" type="xsd:string" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="amount" type="xsd:float" />
+ </xsd:complexType>
+
+ <xsd:complexType name="StockLogEntry">
+ <xsd:attribute name="logSeqNo" type="xsd:int" />
+ <xsd:attribute name="id" type="xsd:int" />
+ <xsd:attribute name="symbol" type="xsd:string" />
+ <xsd:attribute name="quantity" type="xsd:int" />
+ <xsd:attribute name="actionType" type="xsd:string" />
+ <xsd:attribute name="purchaseLotNumber" type="xsd:int" />
+ </xsd:complexType>
+
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="account:getAccountReport"
+ name="getAccountReportRequest" />
+ </wsdl:message>
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="account:getAccountReportResponse"
+ name="getAccountReportResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getCustomerProfileRequest">
+ <wsdl:part element="account:getCustomerProfile"
+ name="getCustomerProfile" />
+ </wsdl:message>
+ <wsdl:message name="getCustomerProfileResponse">
+ <wsdl:part element="account:getCustomerProfileResponse"
+ name="getCustomerProfileResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawRequest">
+ <wsdl:part element="account:withdraw" name="withdrawRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="withdrawResponse">
+ <wsdl:part element="account:withdrawResponse"
+ name="withdrawResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="depositRequest">
+ <wsdl:part element="account:deposit" name="depositRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="depositResponse">
+ <wsdl:part element="account:depositResponse"
+ name="depositResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockRequest">
+ <wsdl:part element="account:purchaseStock"
+ name="purchaseStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="purchaseStockResponse">
+ <wsdl:part element="account:purchaseStockResponse"
+ name="purchaseStockResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="sellStockRequest">
+ <wsdl:part element="account:sellStock" name="sellStockRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountRequest">
+ <wsdl:part element="account:createAccount" name="createAccountRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="createAccountResponse">
+ <wsdl:part element="account:createAccountResponse" name="createAccountResponse" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogRequest">
+ <wsdl:part element="account:getAccountLog"
+ name="getAccountLogRequest" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountLogResponse">
+ <wsdl:part element="account:getAccountLogResponse"
+ name="getAccountLogResponse" />
+ </wsdl:message>
+
+ <wsdl:portType name="AccountService">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="account:getAccountReportRequest" />
+ <wsdl:output message="account:getAccountReportResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getCustomerProfile">
+ <wsdl:input message="account:getCustomerProfileRequest" />
+ <wsdl:output message="account:getCustomerProfileResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <wsdl:input message="account:withdrawRequest" />
+ <wsdl:output message="account:withdrawResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <wsdl:input message="account:depositRequest" />
+ <wsdl:output message="account:depositResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <wsdl:input message="account:purchaseStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <wsdl:input message="account:sellStockRequest" />
+ <wsdl:output message="account:purchaseStockResponse" />
+ </wsdl:operation>
+
+
+ <wsdl:operation name="createAccount">
+ <wsdl:input message="account:createAccountRequest" />
+ <wsdl:output message="account:createAccountResponse" />
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <wsdl:input message="account:getAccountLogRequest" />
+ <wsdl:output message="account:getAccountLogResponse" />
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+
+
+ <wsdl:binding name="AccountServiceSOAP" type="account:AccountService">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountReport" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ <wsdl:operation name="getCustomerProfile">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getCustomerProfile" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="withdraw">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/withdraw" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="deposit">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/deposit" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="purchaseStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/purchaseStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="sellStock">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/sellStock" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="createAccount">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/createAccount" />
+ <wsdl:input>
+ <soap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+
+ <wsdl:operation name="getAccountLog">
+ <soap:operation
+ soapAction="http://www.bigbank.com/account/getAccountLog" />
+ <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="account:AccountServiceSOAP"
+ name="AccountServiceSOAP">
+ <soap:address
+ location="http://localhost:8080/services/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..3921dec72d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/main/resources/wsdl/helloworld.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 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=""/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.java
new file mode 100644
index 0000000000..c11e814058
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/SDOWSDLTestCase.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.itest;
+
+import java.rmi.RemoteException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.services.accountdata.AccountDataService;
+
+import com.bigbank.account.AccountFactory;
+import com.bigbank.account.CustomerProfileData;
+
+/**
+ * Tests all the combinations of wiring services, components, and references
+ * which use either interface.java or interface.wsdl.
+ *
+ * The tests use a service (1) wired to a components (2) wired to another
+ * component (3) wired to a reference (4). Each of those uses either
+ * interface.java (a) or interface.wsdl (b). This results in 16 different
+ * combinations 1a2a3a4a thru 1b2b3b4b.
+ */
+public class SDOWSDLTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ public void testClient1a2a3a4a() throws RemoteException {
+
+ doit("Client1a2a3a4a");
+ doit("Client1a2a3a4b");
+ doit("Client1a2a3b4a");
+ doit("Client1a2a3b4b");
+ doit("Client1a2b3a4a");
+ doit("Client1a2b3a4b");
+ doit("Client1a2b3b4a");
+ doit("Client1a2b3b4b");
+ doit("Client1b2a3a4a");
+ doit("Client1b2a3a4b");
+ doit("Client1b2a3b4a");
+ doit("Client1b2a3b4b");
+
+// TODO: TUSCANY-1135, service using wsdl wired to component using wsdl fails
+// doit("Client1b2b3a4a");
+// doit("Client1b2b3a4b");
+// doit("Client1b2b3b4a");
+// doit("Client1b2b3b4b");
+ }
+
+ private void doit(String compName) throws RemoteException {
+ AccountDataService client = domain.getService(AccountDataService.class, compName);
+ CustomerProfileData dataIn = AccountFactory.INSTANCE.createCustomerProfileData();
+ dataIn.setAddress("home");
+ dataIn.setEmail("petra@home");
+ dataIn.setFirstName("petra");
+ dataIn.setId(1);
+ dataIn.setLastName("A");
+ dataIn.setLoginID("petra");
+ dataIn.setPassword("ant");
+
+ CustomerProfileData dataOut = client.createAccount(dataIn , false, false);
+
+ assertEquals(dataIn.getAddress(), dataOut.getAddress());
+ assertEquals(dataIn.getEmail(), dataOut.getEmail());
+ assertEquals(dataIn.getFirstName(), dataOut.getFirstName());
+ assertEquals(dataIn.getId(), dataOut.getId());
+ assertEquals(dataIn.getLastName(), dataOut.getLastName());
+ assertEquals(dataIn.getLoginID(), dataOut.getLoginID());
+ assertEquals(dataIn.getPassword(), dataOut.getPassword());
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("SDOWSDLTest.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.java
new file mode 100644
index 0000000000..fd30d69c79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/itest/wsdl/src/test/java/org/apache/tuscany/sca/itest/WSDLTestCase.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.itest;
+
+import static junit.framework.Assert.assertEquals;
+import helloworld.HelloWorldService;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Tests all the combinations of wiring services, components, and references
+ * which use either interface.java or interface.wsdl. The tests use a service
+ * (1) wired to a components (2) wired to another component (3) wired to a
+ * reference (4). Each of those uses either interface.java (a) or interface.wsdl
+ * (b). This results in 16 different combinations 1a2a3a4a thru 1b2b3b4b.
+ */
+public class WSDLTestCase {
+
+ private static SCADomain domain;
+
+ @Test
+ public void testClient1a2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1a2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1a2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2a3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2a3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3a4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3a4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4a() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4a");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @Test
+ public void testClient1b2b3b4b() {
+ HelloWorldService client = domain.getService(HelloWorldService.class, "Client1b2b3b4b");
+ assertEquals("Hi petra", client.getGreetings("petra"));
+ }
+
+ @BeforeClass
+ public static void init() throws Throwable {
+ domain = SCADomain.newInstance("WSDLTest.composite");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/pom.xml
new file mode 100644
index 0000000000..879e950ec8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-java-dsl</artifactId>
+ <name>Apache Tuscany SCA Assembly Java DSL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java
new file mode 100644
index 0000000000..28a5ecdc24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.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.assembly.dsl;
+
+
+public interface AssemblyBuilder {
+
+ CompositeBuilder composite(String name);
+
+ ComponentBuilder component(String name);
+
+ ComponentReferenceBuilder reference(String name);
+
+ ComponentServiceBuilder service(String name);
+
+ ComponentPropertyBuilder property(String name);
+
+ CompositeBuilder domain(String uri);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java
new file mode 100644
index 0000000000..98f247e5cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.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.assembly.dsl;
+
+public interface ComponentBuilder {
+
+ ComponentBuilder implementedBy(Class clazz);
+
+ ComponentBuilder implementedBy(CompositeBuilder composite);
+
+ public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences);
+
+ public ComponentBuilder provides(ComponentServiceBuilder... componentServices);
+
+ public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java
new file mode 100644
index 0000000000..7f3c89fd2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.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.assembly.dsl;
+
+public interface ComponentPropertyBuilder {
+
+ ComponentPropertyBuilder ofType(String type);
+
+ ComponentPropertyBuilder configuredTo(Object value);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java
new file mode 100644
index 0000000000..8966a4be9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.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.assembly.dsl;
+
+public interface ComponentReferenceBuilder {
+
+ ComponentReferenceBuilder wiredTo(String target);
+
+ ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target);
+
+ ComponentReferenceBuilder typedBy(Class interfaceClass);
+
+ ComponentReferenceBuilder promotedAs(String promoted);
+
+ ComponentReferenceBuilder promoted();
+
+ ComponentReferenceBuilder boundTo(String uri);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java
new file mode 100644
index 0000000000..f3e36e8c38
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.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.sca.assembly.dsl;
+
+public interface ComponentServiceBuilder {
+
+ ComponentServiceBuilder typedBy(Class interfaceClass);
+
+ ComponentServiceBuilder promotedAs(String promoted);
+
+ ComponentServiceBuilder promoted();
+
+ ComponentServiceBuilder boundTo(String uri);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java
new file mode 100644
index 0000000000..e2108b5ef8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.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.assembly.dsl;
+
+
+public interface CompositeBuilder {
+
+ CompositeBuilder contains(ComponentBuilder... components);
+
+ CompositeBuilder includes(CompositeBuilder... includes);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java
new file mode 100644
index 0000000000..0968310548
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.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.assembly.dsl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.dsl.AssemblyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+
+public class AssemblyBuilderImpl extends DefaultAssemblyFactory implements AssemblyBuilder {
+
+ public ComponentBuilder component(String name) {
+ ComponentBuilderImpl component = new ComponentBuilderImpl();
+ component.setName(name);
+ return component;
+ }
+
+ public CompositeBuilder composite(String name) {
+ CompositeBuilderImpl composite = new CompositeBuilderImpl();
+ //TODO handle namespace
+ composite.setName(new QName("", name));
+ return composite;
+ }
+
+ public CompositeBuilder domain(String uri) {
+ CompositeBuilderImpl composite = new CompositeBuilderImpl();
+ composite.setName(new QName(uri, ""));
+ return composite;
+ }
+
+ public ComponentPropertyBuilder property(String name) {
+ ComponentPropertyBuilderImpl property = new ComponentPropertyBuilderImpl();
+ property.setName(name);
+ return property;
+ }
+
+ public ComponentReferenceBuilder reference(String name) {
+ ComponentReferenceBuilderImpl reference = new ComponentReferenceBuilderImpl(this);
+ reference.setName(name);
+ return reference;
+ }
+
+ public ComponentServiceBuilder service(String name) {
+ ComponentServiceBuilderImpl service = new ComponentServiceBuilderImpl(this);
+ service.setName(name);
+ return service;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java
new file mode 100644
index 0000000000..9022b9d9e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.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.sca.assembly.dsl.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+
+public class ComponentBuilderImpl extends ComponentImpl implements ComponentBuilder {
+
+ public ComponentBuilderImpl() {
+ }
+
+ public ComponentBuilder implementedBy(Class clazz) {
+ //FIXME support Java implementations
+ return this;
+ }
+
+ public ComponentBuilder implementedBy(CompositeBuilder composite) {
+ setImplementation((Composite)composite);
+ return this;
+ }
+
+ public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences) {
+ List<ComponentReference> references = getReferences();
+ for (ComponentReferenceBuilder componentReference: componentReferences) {
+ references.add((ComponentReference)componentReference);
+ }
+ return this;
+ }
+
+ public ComponentBuilder provides(ComponentServiceBuilder... componentServices) {
+ List<ComponentService> services = getServices();
+ for (ComponentServiceBuilder componentService: componentServices) {
+ services.add((ComponentService)componentService);
+ }
+ return this;
+ }
+
+ public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties) {
+ List<ComponentProperty> properties = getProperties();
+ for (ComponentPropertyBuilder componentProperty: componentProperties) {
+ properties.add((ComponentProperty)componentProperty);
+ }
+ return this;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java
new file mode 100644
index 0000000000..49f7cd46b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.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.assembly.dsl.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentPropertyImpl;
+
+public class ComponentPropertyBuilderImpl extends ComponentPropertyImpl implements ComponentPropertyBuilder {
+
+ public ComponentPropertyBuilderImpl ofType(String type) {
+ //TODO handle namespace
+ this.setXSDType(new QName("", type));
+ return this;
+ }
+
+ public ComponentPropertyBuilderImpl configuredTo(Object value) {
+ this.setValue(value);
+ return this;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java
new file mode 100644
index 0000000000..d9aab9de22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.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.assembly.dsl.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+
+public class ComponentReferenceBuilderImpl extends ComponentReferenceImpl implements ComponentReferenceBuilder {
+
+ private CompositeReference compositeReference;
+ private AssemblyFactory assemblyFactory;
+
+ protected ComponentReferenceBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public ComponentReferenceBuilder wiredTo(String target) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setUnresolved(true);
+ componentService.setName(target);
+ getTargets().add(componentService);
+ return this;
+ }
+
+ public ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target) {
+ getTargets().add((ComponentServiceImpl)target);
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl typedBy(Class interfaceClass) {
+ //FIXME support for Java interfaces
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl promotedAs(String promoted) {
+ compositeReference = assemblyFactory.createCompositeReference();
+ compositeReference.setName(promoted);
+ return this;
+ }
+
+ public ComponentReferenceBuilderImpl promoted() {
+ compositeReference = assemblyFactory.createCompositeReference();
+ compositeReference.setName(getName());
+ return this;
+ }
+
+ public ComponentReferenceBuilder boundTo(String uri) {
+ //TODO support bindings
+ return this;
+ }
+
+ CompositeReference getCompositeReference() {
+ return compositeReference;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java
new file mode 100644
index 0000000000..379429d17e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.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.assembly.dsl.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+
+public class ComponentServiceBuilderImpl extends ComponentServiceImpl implements ComponentServiceBuilder {
+
+ private CompositeService compositeService;
+ private AssemblyFactory assemblyFactory;
+
+ protected ComponentServiceBuilderImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public ComponentServiceBuilderImpl typedBy(Class interfaceClass) {
+ //FIXME support for Java interfaces
+ return this;
+ }
+
+ public ComponentServiceBuilderImpl promotedAs(String promoted) {
+ compositeService = assemblyFactory.createCompositeService();
+ compositeService.setName(promoted);
+ return this;
+ }
+
+ public ComponentServiceBuilderImpl promoted() {
+ compositeService = assemblyFactory.createCompositeService();
+ compositeService.setName(getName());
+ return this;
+ }
+
+ public ComponentServiceBuilder boundTo(String uri) {
+ // TODO support bindings
+ return this;
+ }
+
+ CompositeService getCompositeService() {
+ return compositeService;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java
new file mode 100644
index 0000000000..709562cd72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.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.assembly.dsl.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder;
+import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
+
+public class CompositeBuilderImpl extends CompositeImpl implements CompositeBuilder {
+
+ public CompositeBuilder contains(ComponentBuilder... componentBuilders) {
+ List<Component> components = getComponents();
+ for (ComponentBuilder componentBuilder: componentBuilders) {
+ Component component = (Component)componentBuilder;
+ components.add(component);
+
+ for (ComponentService componentService: component.getServices()) {
+ ComponentServiceBuilderImpl builder = (ComponentServiceBuilderImpl)componentService;
+ if (builder.getCompositeService() != null)
+ getServices().add(builder.getCompositeService());
+ }
+ for (ComponentReference componentReference: component.getReferences()) {
+ ComponentReferenceBuilderImpl builder = (ComponentReferenceBuilderImpl)componentReference;
+ if (builder.getCompositeReference() != null)
+ getReferences().add(builder.getCompositeReference());
+ }
+ }
+ return this;
+ }
+
+ public CompositeBuilder includes(CompositeBuilder... compositeBuilders) {
+ List<Composite> list = getIncludes();
+ for (CompositeBuilder composite: compositeBuilders) {
+ list.add((Composite)composite);
+ }
+ return this;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.java
new file mode 100644
index 0000000000..ba91fd2168
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataService.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.assembly.dsl;
+
+public interface AccountDataService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..4e239d03d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountDataServiceImpl.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.assembly.dsl;
+
+public class AccountDataServiceImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.java
new file mode 100644
index 0000000000..030c820ed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountService.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.assembly.dsl;
+
+public interface AccountService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.java
new file mode 100644
index 0000000000..92f448ec87
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/AccountServiceImpl.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.assembly.dsl;
+
+public class AccountServiceImpl {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.java
new file mode 100644
index 0000000000..b856201551
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilder.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 org.apache.tuscany.sca.assembly.dsl;
+
+import org.apache.tuscany.sca.assembly.dsl.impl.AssemblyBuilderImpl;
+
+public class BigBankBuilder extends AssemblyBuilderImpl {
+
+ public CompositeBuilder build() {
+
+ CompositeBuilder bigbankAccount = composite("bigbank.account").contains(
+
+ component("AccountServiceComponent").
+ implementedBy(AccountServiceImpl.class).
+ uses(
+ reference("accountDataService").typedBy(AccountDataService.class).wiredTo("AccountDataServiceComponent/AccountDataService"),
+ reference("stockQuoteService").promotedAs("StockQuoteService")
+ ).
+ provides(
+ service("AccountDataService").typedBy(AccountService.class).promoted()
+ ).
+ declares(
+ property("currency").ofType("string").configuredTo("USD")
+ ),
+
+ component("AccountDataServiceComponent").
+ implementedBy(AccountDataServiceImpl.class).
+ provides(
+ service("AccountDataService").typedBy(AccountDataService.class)
+ )
+ );
+
+ CompositeBuilder bigbankApp = composite("bigbank.app").
+ contains(
+ component("BigBankAccount").implementedBy(bigbankAccount)
+ );
+
+ CompositeBuilder domain = domain("http://bigbank.org").includes(bigbankApp);
+
+ return domain;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.java
new file mode 100644
index 0000000000..90a4292546
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/BigBankBuilderTestCase.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.assembly.dsl;
+
+import junit.framework.TestCase;
+
+public class BigBankBuilderTestCase extends TestCase {
+
+ public void testBuild() throws Exception {
+
+ BigBankBuilder builder = new BigBankBuilder();
+ CompositeBuilder domain = builder.build();
+ assertNotNull(domain);
+
+ //System.out.println();
+ //new PrintUtil(System.out).print(domain);
+ //System.out.println();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.java
new file mode 100644
index 0000000000..a0580095a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-java-dsl/src/test/java/org/apache/tuscany/sca/assembly/dsl/StockQuoteService.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.assembly.dsl;
+
+public interface StockQuoteService {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.ruleset
new file mode 100644
index 0000000000..830b4cfee4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/.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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/pom.xml
new file mode 100644
index 0000000000..e1ab513836
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <name>Apache Tuscany SCA XML Assembly Support</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseArtifactProcessor.java
new file mode 100644
index 0000000000..9223fa8947
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseArtifactProcessor.java
@@ -0,0 +1,686 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+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.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * A base class with utility methods for the other artifact processors in this module.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class BaseArtifactProcessor implements Constants {
+
+ protected AssemblyFactory assemblyFactory;
+ protected PolicyFactory policyFactory;
+ protected StAXArtifactProcessor<Object> extensionProcessor;
+
+ private static final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+ static {
+ domFactory.setNamespaceAware(true);
+ }
+
+ /**
+ * Construcst a new BaseArtifactProcessor.
+ * @param factory
+ * @param policyFactory
+ */
+ @SuppressWarnings("unchecked")
+ public BaseArtifactProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor) {
+ this.assemblyFactory = factory;
+ this.policyFactory = policyFactory;
+ this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
+ }
+
+ /**
+ * Returns the string value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected String getString(XMLStreamReader reader, String name) {
+ return reader.getAttributeValue(null, name);
+ }
+
+ /**
+ * Returns the qname value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected QName getQName(XMLStreamReader reader, String name) {
+ String qname = reader.getAttributeValue(null, name);
+ return getQNameValue(reader, qname);
+ }
+
+ /**
+ * Returns the value of xsi:type attribute
+ * @param reader The XML stream reader
+ * @return The QName of the type, if the attribute is not present, null is
+ * returned.
+ */
+ protected QName getXSIType(XMLStreamReader reader) {
+ String qname = reader.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+ return getQNameValue(reader, qname);
+ }
+
+ /**
+ * Returns a qname from a string.
+ * @param reader
+ * @param value
+ * @return
+ */
+ protected QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Returns the boolean value of an attribute.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected boolean getBoolean(XMLStreamReader reader, String name) {
+ String value = reader.getAttributeValue(null, name);
+ if (value == null) {
+ value = Boolean.toString(false);
+ }
+ return Boolean.valueOf(value);
+ }
+
+ /**
+ * Returns the value of an attribute as a list of qnames.
+ * @param reader
+ * @param name
+ * @return
+ */
+ protected List<QName> getQNames(XMLStreamReader reader, String name) {
+ String value = reader.getAttributeValue(null, name);
+ if (value != null) {
+ List<QName> qnames = new ArrayList<QName>();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ qnames.add(getQName(reader, tokens.nextToken()));
+ }
+ return qnames;
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+ /**
+ * Read policy intents.
+ * @param attachPoint
+ * @param reader
+ */
+ protected void readIntents(IntentAttachPoint attachPoint, XMLStreamReader reader) {
+ readIntents(attachPoint, null, reader);
+ }
+
+ /**
+ * Read policy intents associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ protected void readIntents(IntentAttachPoint attachPoint, Operation operation, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ if (operation != null) {
+ intent.getOperations().add(operation);
+ }
+ requiredIntents.add(intent);
+ }
+ }
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ protected void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
+ readPolicies(attachPoint, null, reader);
+ }
+
+ /**
+ * Reads policy intents and policy sets associated with an operation.
+ * @param attachPoint
+ * @param operation
+ * @param reader
+ */
+ protected void readPolicies(PolicySetAttachPoint attachPoint, Operation operation, XMLStreamReader reader) {
+ readIntents(attachPoint, operation, reader);
+
+ String value = reader.getAttributeValue(null, Constants.POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ if (operation != null) {
+ policySet.getOperations().add(operation);
+ }
+ policySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Read list of reference targets
+ * @param reference
+ * @param reader
+ */
+ protected void readTargets(Reference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.TARGET);
+ ComponentService target = null;
+ if (value != null) {
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ target = assemblyFactory.createComponentService();
+ target.setUnresolved(true);
+ target.setName(tokens.nextToken());
+ reference.getTargets().add(target);
+ }
+ }
+ }
+
+ /**
+ * Read a multiplicity attribute.
+ * @param reference
+ * @param reader
+ */
+ protected void readMultiplicity(AbstractReference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, MULTIPLICITY);
+ if (ZERO_ONE.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ } else if (ONE_N.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else if (ZERO_N.equals(value)) {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ }
+
+ /**
+ * Returns the value of a constrainingType attribute.
+ * @param reader
+ * @return
+ */
+ protected ConstrainingType getConstrainingType(XMLStreamReader reader) {
+ QName constrainingTypeName = getQName(reader, "constrainingType");
+ if (constrainingTypeName != null) {
+ ConstrainingType constrainingType = assemblyFactory.createConstrainingType();
+ constrainingType.setName(constrainingTypeName);
+ constrainingType.setUnresolved(true);
+ return constrainingType;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Reads an abstract property element.
+ * @param prop
+ * @param reader
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ */
+ protected void readAbstractProperty(AbstractProperty prop, XMLStreamReader reader)
+ throws XMLStreamException, ContributionReadException {
+ prop.setName(getString(reader, "name"));
+ prop.setMany(getBoolean(reader, "many"));
+ prop.setMustSupply(getBoolean(reader, "mustSupply"));
+ prop.setXSDElement(getQName(reader, "element"));
+ prop.setXSDType(getQName(reader, "type"));
+ try {
+ Document value = readPropertyValue(reader, prop.getXSDType());
+ prop.setValue(value);
+ } catch (ParserConfigurationException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ /**
+ * Reads a property element.
+ * @param prop
+ * @param reader
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ */
+ protected void readProperty(Property prop, XMLStreamReader reader)
+ throws XMLStreamException, ContributionReadException {
+ readAbstractProperty(prop, reader);
+ }
+
+ /**
+ * Parse the next child element.
+ * @param reader
+ * @return
+ * @throws XMLStreamException
+ */
+ protected boolean nextChildElement(XMLStreamReader reader) throws XMLStreamException {
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == END_ELEMENT) {
+ return false;
+ }
+ if (event == START_ELEMENT) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Advance the stream to the next END_ELEMENT event skipping any nested
+ * content.
+ * @param reader the reader to advance
+ * @throws XMLStreamException if there was a problem reading the stream
+ */
+ protected void skipToEndElement(XMLStreamReader reader) throws XMLStreamException {
+ int depth = 0;
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ depth++;
+ } else if (event == XMLStreamConstants.END_ELEMENT) {
+ if (depth == 0) {
+ return;
+ }
+ depth--;
+ }
+ }
+ }
+
+ /**
+ * 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 interface and callback interface on a list of abstract contracts.
+ * @param contracts the list of contracts
+ * @param resolver the resolver to use to resolve models
+ */
+ protected <C extends AbstractContract> void resolveAbstractContracts(List<C> contracts, ModelResolver resolver) throws ContributionResolveException {
+ for (AbstractContract contract: contracts) {
+
+ // Resolve the interface contract
+ InterfaceContract interfaceContract = contract.getInterfaceContract();
+ if (interfaceContract != null) {
+ extensionProcessor.resolve(interfaceContract, resolver);
+ }
+ }
+ }
+
+ /**
+ * Start an element.
+ * @param uri
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartElement(uri, name);
+ writeAttributes(writer, attrs);
+ }
+
+ /**
+ * Start an element.
+ * @param writer
+ * @param name
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeStart(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartElement(SCA10_NS, name);
+ writeAttributes(writer, attrs);
+ }
+
+ /**
+ * End an element.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeEnd(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndElement();
+ }
+
+ /**
+ * Start a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeStartDocument(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
+ writer.writeStartDocument();
+ writer.setDefaultNamespace(SCA10_NS);
+ writeStart(writer, name, attrs);
+ writer.writeDefaultNamespace(SCA10_NS);
+ }
+
+ /**
+ * End a document.
+ * @param writer
+ * @throws XMLStreamException
+ */
+ protected void writeEndDocument(XMLStreamWriter writer) throws XMLStreamException {
+ writer.writeEndDocument();
+ }
+
+ /**
+ * Write attributes to the current element.
+ * @param writer
+ * @param attrs
+ * @throws XMLStreamException
+ */
+ protected void writeAttributes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
+ for (XAttr attr : attrs) {
+ if (attr != null)
+ attr.write(writer);
+ }
+ }
+
+ /**
+ * Write an SCA abstract property declaration.
+ * @param writer
+ * @param prop
+ */
+ protected void writeAbstractProperty(XMLStreamWriter writer, AbstractProperty prop) throws XMLStreamException {
+ }
+
+ /**
+ * Write an SCA property declaration.
+ * @param writer
+ * @param prop
+ */
+ protected void writeProperty(XMLStreamWriter writer, Property prop) throws XMLStreamException {
+ writeAbstractProperty(writer, prop);
+ }
+
+ /**
+ * Returns a constrainingType attribute.
+ * @param componentType
+ * @return
+ */
+ protected QName getConstrainingTypeAttr(ComponentType componentType) {
+ ConstrainingType constrainingType = componentType.getConstrainingType();
+ if (constrainingType != null)
+ return constrainingType.getName();
+ else
+ return null;
+ }
+
+ /**
+ * Read a property value into a DOM document.
+ * @param reader
+ * @param type
+ * @return
+ * @throws XMLStreamException
+ * @throws ContributionReadException
+ * @throws ParserConfigurationException
+ */
+ protected Document readPropertyValue(XMLStreamReader reader, QName type)
+ throws XMLStreamException, ParserConfigurationException {
+
+ Document doc = createDocument();
+
+ // root element has no namespace and local name "value"
+ Element root = doc.createElementNS(null, "value");
+ if (type != null) {
+ org.w3c.dom.Attr xsi = doc.createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
+ xsi.setValue(W3C_XML_SCHEMA_INSTANCE_NS_URI);
+ root.setAttributeNodeNS(xsi);
+
+ String prefix = type.getPrefix();
+ if (prefix == null || prefix.length() == 0) {
+ prefix = "ns";
+ }
+
+ declareNamespace(root, prefix, type.getNamespaceURI());
+
+ org.w3c.dom.Attr xsiType = doc.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
+ xsiType.setValue(prefix + ":" + type.getLocalPart());
+ root.setAttributeNodeNS(xsiType);
+ }
+ doc.appendChild(root);
+
+ loadElement(reader, root);
+ return doc;
+ }
+
+ /**
+ * Create a new DOM document.
+ * @return
+ * @throws ContributionReadException
+ */
+ private Document createDocument() throws ParserConfigurationException {
+ return domFactory.newDocumentBuilder().newDocument();
+ }
+
+ /**
+ * Create a DOM element
+ * @param document
+ * @param name
+ * @return
+ */
+ private Element createElement(Document document, QName name) {
+ String prefix = name.getPrefix();
+ String qname = (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name
+ .getLocalPart();
+ return document.createElementNS(name.getNamespaceURI(), qname);
+ }
+
+ /**
+ * Declare a namespace.
+ * @param element
+ * @param prefix
+ * @param ns
+ */
+ private void declareNamespace(Element element, String prefix, String ns) {
+ String qname = null;
+ if ("".equals(prefix)) {
+ qname = "xmlns";
+ } else {
+ qname = "xmlns:" + prefix;
+ }
+ Node node = element;
+ boolean declared = false;
+ while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
+ NamedNodeMap attrs = node.getAttributes();
+ if (attrs == null) {
+ break;
+ }
+ Node attr = attrs.getNamedItem(qname);
+ if (attr != null) {
+ declared = ns.equals(attr.getNodeValue());
+ break;
+ }
+ node = node.getParentNode();
+ }
+ if (!declared) {
+ org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
+ attr.setValue(ns);
+ element.setAttributeNodeNS(attr);
+ }
+ }
+
+ /**
+ * Load a property value specification from an StAX stream into a DOM
+ * Document. Only elements, text and attributes are processed; all comments
+ * and other whitespace are ignored.
+ *
+ * @param reader the stream to read from
+ * @param root the DOM node to load
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ private void loadElement(XMLStreamReader reader, Element root) throws XMLStreamException {
+ Document document = root.getOwnerDocument();
+ Node current = root;
+ while (true) {
+ switch (reader.next()) {
+ case XMLStreamConstants.START_ELEMENT:
+ QName name = reader.getName();
+ Element child = createElement(document, name);
+
+ // push the new element and make it the current one
+ current.appendChild(child);
+ current = child;
+
+ declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
+
+ int count = reader.getNamespaceCount();
+ for (int i = 0; i < count; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String ns = reader.getNamespaceURI(i);
+ declareNamespace(child, prefix, ns);
+ }
+
+ // add the attributes for this element
+ count = reader.getAttributeCount();
+ for (int i = 0; i < count; i++) {
+ String ns = reader.getAttributeNamespace(i);
+ String prefix = reader.getAttributePrefix(i);
+ String localPart = reader.getAttributeLocalName(i);
+ String value = reader.getAttributeValue(i);
+ child.setAttributeNS(ns, localPart, value);
+ declareNamespace(child, prefix, ns);
+ }
+
+ break;
+ case XMLStreamConstants.CDATA:
+ current.appendChild(document.createCDATASection(reader.getText()));
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ current.appendChild(document.createTextNode(reader.getText()));
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ // if we are back at the root then we are done
+ if (current == root) {
+ return;
+ }
+
+ // pop the element off the stack
+ current = current.getParentNode();
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
new file mode 100644
index 0000000000..32655689b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.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.assembly.ComponentType;
+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;
+
+/**
+ * A componentType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeDocumentProcessor extends BaseArtifactProcessor implements URLArtifactProcessor<ComponentType> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public ComponentType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ reader.nextTag();
+ ComponentType componentType = (ComponentType)extensionProcessor.read(reader);
+ componentType.setURI(url.toString());
+ return componentType;
+
+ } 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(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(componentType, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".componentType";
+ }
+
+ public Class<ComponentType> getModelType() {
+ return ComponentType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
new file mode 100644
index 0000000000..386842e8d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
@@ -0,0 +1,271 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.assembly.Base;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+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.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A componentType processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeProcessor extends BaseArtifactProcessor implements StAXArtifactProcessor<ComponentType> {
+
+ /**
+ * Constructs a new componentType processor.
+ * @param factory
+ * @param policyFactory
+ * @param registry
+ */
+ public ComponentTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor) {
+ super(factory, policyFactory, extensionProcessor);
+ }
+
+ public ComponentType read(XMLStreamReader reader) throws ContributionReadException {
+ ComponentType componentType = null;
+ Service service = null;
+ Reference reference = null;
+ Contract contract = null;
+ Property property = null;
+ Callback callback = null;
+ QName name = null;
+
+ try {
+
+ // Read the componentType document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (Constants.COMPONENT_TYPE_QNAME.equals(name)) {
+
+ // Read a <componentType>
+ componentType = assemblyFactory.createComponentType();
+ componentType.setConstrainingType(getConstrainingType(reader));
+ readPolicies(componentType, reader);
+
+ } else if (Constants.SERVICE_QNAME.equals(name)) {
+
+ // Read a <service>
+ service = assemblyFactory.createService();
+ contract = service;
+ service.setName(getString(reader, Constants.NAME));
+ componentType.getServices().add(service);
+ readPolicies(service, reader);
+
+ } else if (Constants.REFERENCE_QNAME.equals(name)) {
+ // Read a <reference>
+ reference = assemblyFactory.createReference();
+ contract = reference;
+ reference.setName(getString(reader, Constants.NAME));
+ reference.setWiredByImpl(getBoolean(reader, Constants.WIRED_BY_IMPL));
+ readMultiplicity(reference, reader);
+ readTargets(reference, reader);
+ componentType.getReferences().add(reference);
+ readPolicies(reference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ property = assemblyFactory.createProperty();
+ readPolicies(property, reader);
+ readProperty(property, reader);
+ componentType.getProperties().add(property);
+
+ } else if (Constants.CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ readPolicies(callback, reader);
+
+ } else if (OPERATION.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = assemblyFactory.createOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ readPolicies(callback, operation, reader);
+ } else {
+ readPolicies(contract, operation, reader);
+ }
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and <reference><interface>
+ contract.setInterfaceContract((InterfaceContract)extension);
+
+ } else if (extension instanceof Binding) {
+
+ // <service><binding> and <reference><binding>
+ contract.getBindings().add((Binding)extension);
+ }
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ service = null;
+ contract = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ reference = null;
+ contract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ property = null;
+ } else if (CALLBACK_QNAME.equals(name)) {
+ callback = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ return componentType;
+ }
+
+ public void validate(ComponentType componentType, List<Base> problems) {
+ if (problems == null) {
+ problems = new ArrayList<Base>();
+ }
+ validatePropertyDefinitions(componentType.getProperties(), problems);
+ }
+
+ public void validatePropertyDefinitions(List<Property> properties, List<Base> problems) {
+ for(Property aProperty : properties) {
+ if (aProperty.isMustSupply() && aProperty.getValue() != null) {
+ problems.add(aProperty);
+ }
+ }
+ }
+
+ public void write(ComponentType componentType, XMLStreamWriter writer) throws ContributionWriteException {
+
+ try {
+ writeStartDocument(writer, COMPONENT_TYPE,
+ new XAttr(CONSTRAINING_TYPE, getConstrainingTypeAttr(componentType)));
+
+ for (Service service : componentType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()));
+
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ for (Binding binding: service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (service.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Reference reference : componentType.getReferences()) {
+ // TODO handle multivalued target attribute
+ String target = reference.getTargets().isEmpty() ? null : reference.getTargets().get(0).getName();
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()),
+ new XAttr(TARGET, target));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Binding binding: reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (reference.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Property property : componentType.getProperties()) {
+ writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve component type services and references
+ resolveContracts(componentType.getServices(), resolver);
+ resolveContracts(componentType.getReferences(), resolver);
+ }
+
+ public QName getArtifactType() {
+ return COMPONENT_TYPE_QNAME;
+ }
+
+ public Class<ComponentType> getModelType() {
+ return ComponentType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
new file mode 100644
index 0000000000..feafb73c05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.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.assembly.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.assembly.Composite;
+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;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeDocumentProcessor extends BaseArtifactProcessor implements URLArtifactProcessor<Composite> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ reader.nextTag();
+ Composite composite = (Composite)extensionProcessor.read(reader);
+ return composite;
+
+ } 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(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(composite, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".composite";
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
new file mode 100644
index 0000000000..6e68780ff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
@@ -0,0 +1,503 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+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.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+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.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A composite processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeProcessor extends BaseArtifactProcessor implements StAXArtifactProcessor<Composite> {
+
+ /**
+ * Construct a new composite processor
+ * @param assemblyFactory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public CompositeProcessor(AssemblyFactory factory, PolicyFactory policyFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ StAXArtifactProcessor extensionProcessor) {
+ super(factory, policyFactory, extensionProcessor);
+ }
+
+ public Composite read(XMLStreamReader reader) throws ContributionReadException {
+ Composite composite = null;
+ Composite include = null;
+ Component component = null;
+ Property property = null;
+ ComponentService componentService = null;
+ ComponentReference componentReference = null;
+ ComponentProperty componentProperty = null;
+ CompositeService compositeService = null;
+ CompositeReference compositeReference = null;
+ Contract contract = null;
+ Wire wire = null;
+ Callback callback = null;
+ QName name = null;
+
+ try {
+
+ // Read the composite document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+ case START_ELEMENT:
+ name = reader.getName();
+
+ if (COMPOSITE_QNAME.equals(name)) {
+
+ // Read a <composite>
+ composite = assemblyFactory.createComposite();
+ composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
+ composite.setAutowire(getBoolean(reader, AUTOWIRE));
+ composite.setLocal(getBoolean(reader, LOCAL));
+ composite.setConstrainingType(getConstrainingType(reader));
+ readPolicies(composite, reader);
+
+ } else if (INCLUDE_QNAME.equals(name)) {
+
+ // Read an <include>
+ include = assemblyFactory.createComposite();
+ include.setUnresolved(true);
+ composite.getIncludes().add(include);
+
+ } else if (SERVICE_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><service>
+ componentService = assemblyFactory.createComponentService();
+ contract = componentService;
+ componentService.setName(getString(reader, NAME));
+ component.getServices().add(componentService);
+ readPolicies(contract, reader);
+ } else {
+
+ // Read a <composite><service>
+ compositeService = assemblyFactory.createCompositeService();
+ contract = compositeService;
+ compositeService.setName(getString(reader, NAME));
+
+ ComponentService promoted = assemblyFactory.createComponentService();
+ promoted.setUnresolved(true);
+ promoted.setName(getString(reader, PROMOTE));
+ compositeService.setPromotedService(promoted);
+
+ composite.getServices().add(compositeService);
+ readPolicies(contract, reader);
+ }
+
+ } else if (REFERENCE_QNAME.equals(name)) {
+ if (component != null) {
+ // Read a <component><reference>
+ componentReference = assemblyFactory.createComponentReference();
+ contract = componentReference;
+ componentReference.setName(getString(reader, NAME));
+ readMultiplicity(componentReference, reader);
+ componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
+ readTargets(componentReference, reader);
+ componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+ component.getReferences().add(componentReference);
+ readPolicies(contract, reader);
+ } else {
+ // Read a <composite><reference>
+ compositeReference = assemblyFactory.createCompositeReference();
+ contract = compositeReference;
+ compositeReference.setName(getString(reader, NAME));
+ readMultiplicity(compositeReference, reader);
+ readTargets(compositeReference, reader);
+ readPromotes(compositeReference, reader);
+ compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
+ composite.getReferences().add(compositeReference);
+ readPolicies(contract, reader);
+ }
+
+ } else if (PROPERTY_QNAME.equals(name)) {
+ if (component != null) {
+ // Read a <component><property>
+ componentProperty = assemblyFactory.createComponentProperty();
+ property = componentProperty;
+ componentProperty.setSource(getString(reader, SOURCE));
+ componentProperty.setFile(getString(reader, FILE));
+ readPolicies(property, reader);
+ readProperty(componentProperty, reader);
+ component.getProperties().add(componentProperty);
+ } else {
+
+ // Read a <composite><property>
+ property = assemblyFactory.createProperty();
+ readPolicies(property, reader);
+ readProperty(property, reader);
+ composite.getProperties().add(property);
+ }
+
+ } else if (COMPONENT_QNAME.equals(name)) {
+
+ // Read a <component>
+ component = assemblyFactory.createComponent();
+ component.setName(getString(reader, NAME));
+ component.setConstrainingType(getConstrainingType(reader));
+ composite.getComponents().add(component);
+ readPolicies(component, reader);
+
+ } else if (WIRE_QNAME.equals(name)) {
+
+ // Read a <wire>
+ wire = assemblyFactory.createWire();
+ ComponentReference source = assemblyFactory.createComponentReference();
+ source.setUnresolved(true);
+ source.setName(getString(reader, SOURCE));
+ wire.setSource(source);
+
+ ComponentService target = assemblyFactory.createComponentService();
+ target.setUnresolved(true);
+ target.setName(getString(reader, TARGET));
+ wire.setTarget(target);
+
+ composite.getWires().add(wire);
+ readPolicies(wire, reader);
+
+ } else if (CALLBACK_QNAME.equals(name)) {
+
+ // Read a <callback>
+ callback = assemblyFactory.createCallback();
+ contract.setCallback(callback);
+ readPolicies(callback, reader);
+
+ } else if (OPERATION_QNAME.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = assemblyFactory.createOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ if (callback != null) {
+ readPolicies(callback, operation, reader);
+ } else {
+ readPolicies(contract, operation, reader);
+ }
+ } else if (IMPLEMENTATION_COMPOSITE_QNAME.equals(name)) {
+
+ // Read an implementation.composite
+ Composite implementation = assemblyFactory.createComposite();
+ implementation.setName(getQName(reader, NAME));
+ implementation.setUnresolved(true);
+ component.setImplementation(implementation);
+
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension != null) {
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and
+ // <reference><interface>
+ contract.setInterfaceContract((InterfaceContract)extension);
+
+ } else if (extension instanceof Binding) {
+ // <service><binding> and <reference><binding>
+ contract.getBindings().add((Binding)extension);
+
+ } else if (extension instanceof Implementation) {
+
+ // <component><implementation>
+ component.setImplementation((Implementation)extension);
+ } else {
+
+ // FIXME: We need to decide where to host the extensions
+ composite.getExtensions().add(extension);
+ }
+ }
+ }
+ break;
+
+ case XMLStreamConstants.CHARACTERS:
+
+ // Read an <include>qname</include>
+ if (include != null && INCLUDE_QNAME.equals(name)) {
+ include.setName(getQNameValue(reader, reader.getText().trim()));
+ }
+
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ componentService = null;
+ compositeService = null;
+ contract = null;
+ } else if (INCLUDE_QNAME.equals(name)) {
+ include = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ componentReference = null;
+ compositeReference = null;
+ contract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ componentProperty = null;
+ property = null;
+ } else if (COMPONENT_QNAME.equals(name)) {
+ component = null;
+ } else if (WIRE_QNAME.equals(name)) {
+ wire = null;
+ } else if (CALLBACK_QNAME.equals(name)) {
+ callback = null;
+ }
+ break;
+ }
+
+ // Read the next element
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return composite;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(Composite composite, XMLStreamWriter writer) throws ContributionWriteException {
+
+ try {
+ writeStartDocument(writer, COMPOSITE,
+ new XAttr(CONSTRAINING_TYPE, getConstrainingTypeAttr(composite)),
+ new XAttr(TARGET_NAMESPACE, composite.getName().getNamespaceURI()),
+ new XAttr(NAME, composite.getName().getLocalPart()));
+
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ ComponentService promotedService = compositeService.getPromotedService();
+ String promote = promotedService != null ? promotedService.getName() : null;
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()), new XAttr(PROMOTE, promote));
+
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ for (Binding binding: service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (service.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Component component : composite.getComponents()) {
+ writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()));
+
+ for (ComponentService service : component.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()));
+
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+
+ for (Binding binding: service.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (service.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (ComponentReference reference : component.getReferences()) {
+ // TODO handle multivalued target attribute
+ String target = reference.getTargets().isEmpty() ? null : reference.getTargets().get(0).getName();
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()),
+ new XAttr(TARGET,target));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Binding binding: reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (reference.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (ComponentProperty property : component.getProperties()) {
+ writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()));
+ writeEnd(writer);
+ }
+
+ // Write the component implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ writeStart(writer, IMPLEMENTATION_COMPOSITE,
+ new XAttr(NAME, composite.getName()));
+ writeEnd(writer);
+ } else {
+ extensionProcessor.write(component.getImplementation(), writer);
+ }
+
+ writeEnd(writer);
+ }
+
+ for (Reference reference : composite.getReferences()) {
+ // TODO handle multivalued promote attribute
+ CompositeReference compositeReference = (CompositeReference)reference;
+ String promote;
+ if (!compositeReference.getPromotedReferences().isEmpty())
+ promote = compositeReference.getPromotedReferences().get(0).getName();
+ else
+ promote = null;
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()),
+ new XAttr(PROMOTE, promote));
+
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+
+ for (Binding binding: reference.getBindings()) {
+ extensionProcessor.write(binding, writer);
+ }
+
+ if (reference.getCallback() != null) {
+ writeStart(writer, CALLBACK);
+ writeEnd(writer);
+ }
+ writeEnd(writer);
+ }
+
+ for (Property property : composite.getProperties()) {
+ writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve constraining type
+ ConstrainingType constrainingType = composite.getConstrainingType();
+ constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+ composite.setConstrainingType(constrainingType);
+
+ // Resolve includes in the composite
+ for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
+ Composite include = composite.getIncludes().get(i);
+ include = resolver.resolveModel(Composite.class, include);
+ composite.getIncludes().set(i, include);
+ }
+
+ // resolve and extensions to the standard SCDL that appear in the
+ // SCDL.
+ for (int i = 0, n = composite.getExtensions().size(); i < n; i++) {
+ Object model = composite.getExtensions().get(i);
+ extensionProcessor.resolve(model, resolver);
+ }
+
+ // Resolve component implementations, services and references
+ for (Component component: composite.getComponents()) {
+ constrainingType = component.getConstrainingType();
+ constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
+ component.setConstrainingType(constrainingType);
+
+ Implementation implementation = component.getImplementation();
+ implementation = resolveImplementation(implementation, resolver);
+ component.setImplementation(implementation);
+
+ resolveContracts(component.getServices(), resolver);
+ resolveContracts(component.getReferences(), resolver);
+ }
+
+ // Resolve composite services and references
+ resolveContracts(composite.getServices(), resolver);
+ resolveContracts(composite.getReferences(), resolver);
+ }
+
+ public QName getArtifactType() {
+ return COMPOSITE_QNAME;
+ }
+
+ public Class<Composite> getModelType() {
+ return Composite.class;
+ }
+
+ /**
+ * Read list of refence targets
+ * @param reference
+ * @param reader
+ */
+ protected void readPromotes(CompositeReference reference, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.PROMOTE);
+ ComponentReference promoted = null;
+ if (value != null) {
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ promoted = assemblyFactory.createComponentReference();
+ promoted.setUnresolved(true);
+ promoted.setName(tokens.nextToken());
+ reference.getPromotedReferences().add(promoted);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
new file mode 100644
index 0000000000..cd98685203
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.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.sca.assembly.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants used in SCA assembly XML files.
+ */
+public interface Constants {
+ String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ String COMPONENT_TYPE = "componentType";
+ QName COMPONENT_TYPE_QNAME = new QName(SCA10_NS, COMPONENT_TYPE);
+ String SERVICE = "service";
+ QName SERVICE_QNAME = new QName(SCA10_NS, SERVICE);
+ String REFERENCE = "reference";
+ QName REFERENCE_QNAME = new QName(SCA10_NS, REFERENCE);
+ String PROPERTY = "property";
+ QName PROPERTY_QNAME = new QName(SCA10_NS, PROPERTY);
+ String CONSTRAINING_TYPE = "constrainingType";
+ QName CONSTRAINING_TYPE_QNAME = new QName(SCA10_NS, CONSTRAINING_TYPE);
+ String COMPOSITE = "composite";
+ QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
+ String INCLUDE = "include";
+ QName INCLUDE_QNAME = new QName(SCA10_NS, INCLUDE);
+ String COMPONENT = "component";
+ QName COMPONENT_QNAME = new QName(SCA10_NS, COMPONENT);
+ String WIRE = "wire";
+ QName WIRE_QNAME = new QName(SCA10_NS, WIRE);
+ String NAME = "name";
+ String TARGET_NAMESPACE = "targetNamespace";
+ String LOCAL = "local";
+ String AUTOWIRE = "autowire";
+ String REQUIRES = "requires";
+ String POLICY_SETS = "policySets";
+ String OPERATION = "operation";
+ QName OPERATION_QNAME = new QName(SCA10_NS, OPERATION);
+ String CALLBACK = "callback";
+ QName CALLBACK_QNAME = new QName(SCA10_NS, CALLBACK);
+ String PROMOTE = "promote";
+ String TARGET = "target";
+ String WIRED_BY_IMPL = "wiredByImpl";
+ String MULTIPLICITY = "multiplicity";
+ String TYPE = "type";
+ String ELEMENT = "element";
+ String MANY = "many";
+ String MUST_SUPPLY = "mustSupply";
+ String SOURCE = "source";
+ String FILE = "file";
+ String URI = "uri";
+ String ZERO_ONE = "0..1";
+ String ZERO_N = "0..n";
+ String ONE_ONE = "1..1";
+ String ONE_N = "1..n";
+ String IMPLEMENTATION_COMPOSITE = "implementation.composite";
+ QName IMPLEMENTATION_COMPOSITE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_COMPOSITE);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
new file mode 100644
index 0000000000..fa22602356
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.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.assembly.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.assembly.ConstrainingType;
+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;
+
+/**
+ * A contrainingType content handler.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeDocumentProcessor extends BaseArtifactProcessor implements URLArtifactProcessor<ConstrainingType> {
+ private XMLInputFactory inputFactory;
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param staxProcessor
+ */
+ public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor, XMLInputFactory inputFactory) {
+ super(null, null, staxProcessor);
+ this.inputFactory = inputFactory;
+ }
+
+ public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
+ InputStream urlStream = null;
+ try {
+ urlStream = url.openStream();
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
+ reader.nextTag();
+ ConstrainingType constrainingType = (ConstrainingType)extensionProcessor.read(reader);
+ return constrainingType;
+
+ } 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(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
+ extensionProcessor.resolve(constrainingType, resolver);
+ }
+
+ public String getArtifactType() {
+ return ".constrainingType";
+ }
+
+ public Class<ConstrainingType> getModelType() {
+ return ConstrainingType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
new file mode 100644
index 0000000000..74a9fc430e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.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.sca.assembly.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.AbstractContract;
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+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.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * A contrainingType content handler.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeProcessor extends BaseArtifactProcessor implements StAXArtifactProcessor<ConstrainingType> {
+
+ /**
+ * Construct a new constrainingType processor.
+ * @param factory
+ * @param policyFactory
+ * @param extensionProcessor
+ */
+ public ConstrainingTypeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessor extensionProcessor) {
+ super(factory, policyFactory, extensionProcessor);
+ }
+
+ public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
+ ConstrainingType constrainingType = null;
+ AbstractService abstractService = null;
+ AbstractReference abstractReference = null;
+ AbstractProperty abstractProperty = null;
+ AbstractContract abstractContract = null;
+ QName name = null;
+
+ try {
+
+ // Read the constrainingType document
+ while (reader.hasNext()) {
+ int event = reader.getEventType();
+ switch (event) {
+
+ case START_ELEMENT:
+ name = reader.getName();
+
+ // Read a <constrainingType>
+ if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
+ constrainingType = assemblyFactory.createConstrainingType();
+ constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
+ readIntents(constrainingType, reader);
+
+ } else if (Constants.SERVICE_QNAME.equals(name)) {
+
+ // Read a <service>
+ abstractService = assemblyFactory.createAbstractService();
+ abstractContract = abstractService;
+ abstractService.setName(getString(reader, Constants.NAME));
+ constrainingType.getServices().add(abstractService);
+ readIntents(abstractService, reader);
+
+ } else if (Constants.REFERENCE_QNAME.equals(name)) {
+
+ // Read a <reference>
+ abstractReference = assemblyFactory.createAbstractReference();
+ abstractContract = abstractReference;
+ abstractReference.setName(getString(reader, Constants.NAME));
+ readMultiplicity(abstractReference, reader);
+ constrainingType.getReferences().add(abstractReference);
+ readIntents(abstractReference, reader);
+
+ } else if (Constants.PROPERTY_QNAME.equals(name)) {
+
+ // Read a <property>
+ abstractProperty = assemblyFactory.createAbstractProperty();
+ readAbstractProperty(abstractProperty, reader);
+ constrainingType.getProperties().add(abstractProperty);
+ readIntents(abstractProperty, reader);
+
+ } else if (OPERATION.equals(name)) {
+
+ // Read an <operation>
+ Operation operation = assemblyFactory.createOperation();
+ operation.setName(getString(reader, NAME));
+ operation.setUnresolved(true);
+ readIntents(abstractContract, operation, reader);
+
+ } else {
+
+ // Read an extension element
+ Object extension = extensionProcessor.read(reader);
+ if (extension instanceof InterfaceContract) {
+
+ // <service><interface> and <reference><interface>
+ abstractContract.setInterfaceContract((InterfaceContract)extension);
+ }
+ }
+ break;
+
+ case END_ELEMENT:
+ name = reader.getName();
+
+ // Clear current state when reading reaching end element
+ if (SERVICE_QNAME.equals(name)) {
+ abstractService = null;
+ abstractContract = null;
+ } else if (REFERENCE_QNAME.equals(name)) {
+ abstractReference = null;
+ abstractContract = null;
+ } else if (PROPERTY_QNAME.equals(name)) {
+ abstractProperty = null;
+ }
+ break;
+ }
+ if (reader.hasNext()) {
+ reader.next();
+ }
+ }
+ return constrainingType;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(ConstrainingType constrainingType, XMLStreamWriter writer) throws ContributionWriteException {
+
+ try {
+ writeStartDocument(writer, CONSTRAINING_TYPE,
+ new XAttr(TARGET_NAMESPACE, constrainingType.getName().getNamespaceURI()),
+ new XAttr(NAME, constrainingType.getName().getLocalPart()));
+
+ for (AbstractService service : constrainingType.getServices()) {
+ writeStart(writer, SERVICE, new XAttr(NAME, service.getName()));
+ extensionProcessor.write(service.getInterfaceContract(), writer);
+ writeEnd(writer);
+ }
+
+ for (AbstractReference reference : constrainingType.getReferences()) {
+ writeStart(writer, REFERENCE,
+ new XAttr(NAME, reference.getName()));
+ extensionProcessor.write(reference.getInterfaceContract(), writer);
+ writeEnd(writer);
+ }
+
+ for (AbstractProperty property : constrainingType.getProperties()) {
+ writeStart(writer, PROPERTY, new XAttr(NAME, property.getName()));
+ writeEnd(writer);
+ }
+
+ writeEndDocument(writer);
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve component type services and references
+ resolveAbstractContracts(constrainingType.getServices(), resolver);
+ resolveAbstractContracts(constrainingType.getReferences(), resolver);
+ }
+
+ public QName getArtifactType() {
+ return CONSTRAINING_TYPE_QNAME;
+ }
+
+ public Class<ConstrainingType> getModelType() {
+ return ConstrainingType.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/XAttr.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/XAttr.java
new file mode 100644
index 0000000000..3c991798de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/XAttr.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.assembly.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+
+/**
+ * Represents an XML attribute that needs to be written to a document.
+ *
+ * @version $Rev$ $Date$
+ */
+class XAttr {
+
+ String uri = Constants.SCA10_NS;
+ String name;
+ Object value;
+
+ public XAttr(String uri, String name, String value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String uri, String name, boolean value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, boolean value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String uri, String name, QName value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public XAttr(String name, QName value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * Writes a string from a qname and registers a prefix for its namespace.
+ * @param reader
+ * @param value
+ * @return
+ */
+ protected String writeQNameValue(XMLStreamWriter writer, QName qname) throws XMLStreamException {
+ if (qname != null) {
+ String prefix = qname.getPrefix();
+ String uri = qname.getNamespaceURI();
+ prefix = writer.getPrefix(uri);
+ if (prefix != null) {
+
+ // Use the prefix already bound to the given uri
+ return prefix + ":" + qname.getLocalPart();
+ } else {
+
+ // Find an available prefix and bind it to the given uri
+ NamespaceContext nsc = writer.getNamespaceContext();
+ for (int i=1; ; i++) {
+ prefix = "ns" + i;
+ if (nsc.getNamespaceURI(prefix) == null) {
+ break;
+ }
+ }
+ writer.setPrefix(prefix, uri);
+ writer.writeNamespace(prefix, uri);
+ return prefix + ":" + qname.getLocalPart();
+ }
+ } else {
+ return null;
+ }
+ }
+
+ void write(XMLStreamWriter writer) throws XMLStreamException {
+ if (value != null) {
+ String str;
+ if (value instanceof QName) {
+ str = writeQNameValue(writer, (QName)value);
+ } else {
+ str = String.valueOf(value);
+ }
+ if (uri != null && !uri.equals(Constants.SCA10_NS)) {
+ writer.writeAttribute(uri, name, str);
+ } else {
+ writer.writeAttribute(name,str);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
new file mode 100644
index 0000000000..110e155bb0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+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.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadAllTestCase extends TestCase {
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+
+ public void setUp() throws Exception {
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+ }
+
+ public void tearDown() throws Exception {
+ staxProcessor = null;
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = (Composite)staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
+ assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "CalculatorComponent"));
+ assertTrue(composite.isLocal());
+ assertFalse(composite.isAutowire());
+ assertEquals(composite.getRequiredIntents().get(0).getName(), new QName("http://test/confidentiality",
+ "confidentiality"));
+ assertEquals(composite.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+
+ Composite include = composite.getIncludes().get(0);
+ assertEquals(include.getName(), new QName("http://calc", "TestAllDivide"));
+
+ CompositeService calcCompositeService = (CompositeService)composite.getServices().get(0);
+ assertEquals(calcCompositeService.getName(), "CalculatorService");
+ assertTrue(calcCompositeService.getPromotedService().isUnresolved());
+ assertEquals(calcCompositeService.getPromotedService().getName(),
+ "CalculatorServiceComponent/CalculatorService");
+ assertEquals(calcCompositeService.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcCompositeService.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ // TODO test operations
+ Callback calcServiceCallback = calcCompositeService.getCallback();
+ assertNotNull(calcServiceCallback);
+ assertEquals(calcServiceCallback.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcServiceCallback.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ // TODO test operations
+
+ Component calcComponent = composite.getComponents().get(0);
+ assertEquals(calcComponent.getName(), "CalculatorServiceComponent");
+ assertEquals(calcComponent.isAutowire(), false);
+ assertEquals(calcComponent.getConstrainingType().getName(), new QName("http://calc",
+ "CalculatorComponent"));
+ assertEquals(calcComponent.getRequiredIntents().get(0).getName(), new QName("http://test/confidentiality",
+ "confidentiality"));
+ assertEquals(calcComponent.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+
+ ComponentService calcComponentService = calcComponent.getServices().get(0);
+ assertEquals(calcComponentService.getName(), "CalculatorService");
+ assertEquals(calcComponentService.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcComponentService.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ // TODO test operations
+
+ ComponentReference calcComponentReference = calcComponent.getReferences().get(0);
+ assertEquals(calcComponentReference.getName(), "addService");
+ assertEquals(calcComponentReference.isAutowire(), false);
+ assertEquals(calcComponentReference.isWiredByImpl(), false);
+ assertEquals(calcComponentReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcComponentReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ // TODO test operations
+
+ Property property = calcComponent.getProperties().get(0);
+ assertEquals(property.getName(), "round");
+ Document doc = (Document) property.getValue();
+ Element element = doc.getDocumentElement();
+ String value = element.getTextContent();
+ assertEquals(value, "true");
+ assertEquals(property.getXSDType(), new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+ assertEquals(property.isMany(), false);
+
+ CompositeReference calcCompositeReference = (CompositeReference)composite.getReferences().get(0);
+ assertEquals(calcCompositeReference.getName(), "MultiplyService");
+ assertTrue(calcCompositeReference.getPromotedReferences().get(0).isUnresolved());
+ assertEquals(calcCompositeReference.getPromotedReferences().get(0).getName(),
+ "CalculatorServiceComponent/multiplyService");
+ assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ // TODO test operations
+ Callback calcCallback = calcCompositeReference.getCallback();
+ assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+ new QName("http://test/confidentiality", "confidentiality"));
+ assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+ assertNotNull(calcCallback);
+ // TODO test operations
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
new file mode 100644
index 0000000000..967256c54a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.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.sca.assembly.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.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+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.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading SCA XML assembly documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadDocumentTestCase extends TestCase {
+
+ private ExtensibleURLArtifactProcessor documentProcessor;
+ private TestModelResolver resolver;
+
+ public void setUp() throws Exception {
+ AssemblyFactory factory = new DefaultAssemblyFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ // Create Stax processors
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ // Create document processors
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ }
+
+ public void tearDown() throws Exception {
+ documentProcessor = null;
+ resolver = null;
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+
+ URL url = getClass().getResource("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, null, url);
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, null, url);
+ assertNotNull(composite);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ URL url = getClass().getResource("Calculator.composite");
+ Composite nestedComposite = (Composite)documentProcessor.read(null, null, url);
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ url = getClass().getResource("TestAllCalculator.composite");
+ Composite composite = (Composite)documentProcessor.read(null, null, url);
+
+ documentProcessor.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
new file mode 100644
index 0000000000..50a429a82c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.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.sca.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(factory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(componentTypeReader.read(reader));
+ is.close();
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(constrainingTypeReader.read(reader));
+ is.close();
+
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(compositeReader.read(reader));
+ is.close();
+
+ }
+
+ public void testReadCompositeAndWireIt() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ assertNotNull(compositeReader.read(reader));
+ is.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
new file mode 100644
index 0000000000..407354c2d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test resolving SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResolveTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ resolver = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(composite);
+
+ compositeReader.resolve(composite, resolver);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ compositeReader = new CompositeProcessor(factory, policyFactory, mapper, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+
+ compositeReader.resolve(composite, resolver);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/StAXPerfTest.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/StAXPerfTest.java
new file mode 100644
index 0000000000..46ed9ea425
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/StAXPerfTest.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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test the performance of StAX parsing.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAXPerfTest {
+
+ private XMLInputFactory inputFactory;
+ private AssemblyFactory assemblyFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper interfaceContractMapper;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+
+ public static void main(String[] args) throws Exception {
+
+ StAXPerfTest perfTest = new StAXPerfTest();
+ perfTest.setUp();
+
+ // Warm up
+ for (long i = 0; i < 500; i++) {
+ perfTest.testReadComposite();
+ }
+
+ long begin = System.currentTimeMillis();
+ long iter = 50000;
+ for (long i = 0; i < iter; i++) {
+ perfTest.testReadComposite();
+ }
+ long end = System.currentTimeMillis();
+ System.out.println("Iterations: " + iter);
+ double time = ((double)(end - begin)) / ((double)iter);
+ System.out.println("Time: " + time);
+ System.out.println("Memory: " + Runtime.getRuntime().totalMemory() / 1024);
+
+ }
+
+ public void setUp() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ assemblyFactory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ interfaceContractMapper = new InterfaceContractMapperImpl();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ }
+
+ public void tearDown() throws Exception {
+ assemblyFactory = null;
+ policyFactory = null;
+ inputFactory = null;
+ staxProcessors = null;
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ CompositeProcessor loader = new CompositeProcessor(assemblyFactory,
+ policyFactory, interfaceContractMapper, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+
+ Composite composite = loader.read(reader);
+ is.close();
+
+ if (composite == null) {
+ throw new IllegalStateException("Null composite");
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java
new file mode 100644
index 0000000000..7a4077188a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/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.assembly.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(ClassLoader classLoader) {
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
new file mode 100644
index 0000000000..2b95057f23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test the wiring of SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireTestCase extends TestCase {
+
+ private XMLInputFactory inputFactory;
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ resolver = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testResolveConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+ is.close();
+ assertNotNull(constrainingType);
+ resolver.addModel(constrainingType);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(composite);
+
+ compositeReader.resolve(composite, resolver);
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ assertEquals(composite.getConstrainingType(), constrainingType);
+ assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+ }
+
+ public void testResolveComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ CompositeProcessor compositeReader = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite nestedComposite = compositeReader.read(reader);
+ is.close();
+ assertNotNull(nestedComposite);
+ resolver.addModel(nestedComposite);
+
+ is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ compositeReader = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeReader.read(reader);
+ is.close();
+
+ compositeReader.resolve(composite, resolver);
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
new file mode 100644
index 0000000000..39b9b04a3e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.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.sca.assembly.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing SCA XML assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteAllTestCase extends TestCase {
+ private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private TestModelResolver resolver;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private CompositeBuilderImpl compositeUtil;
+
+
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ }
+
+ public void tearDown() throws Exception {
+ staxProcessors = null;
+ resolver = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+ public void testReadWireWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ staxProcessor.resolve(composite, resolver);
+ compositeUtil.build(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ staxProcessor.resolve(componentType, resolver);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ staxProcessor.resolve(constrainingType, resolver);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
new file mode 100644
index 0000000000..4546fddb2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
@@ -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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..072fe8fde1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,34 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..d67ba3ec2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
@@ -0,0 +1,31 @@
+<?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">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
new file mode 100644
index 0000000000..2fedb28df2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator" policySets="sns:secure"
+ requires="cns:confidentiality" targetNamespace="http://calc" xmlns:tns="http://calc"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 "
+ xmlns:cns="http://test/confidentiality" xmlns:sns="http://test/secure">
+
+ <include>tns:TestAllDivide</include>
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:confidentiality"
+ policySets="sns:secure">
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ <operation name="add" policySets="sns:secure" requires="cns:confidentiality" />
+
+ <binding.ws name="CalculatorWS" policySets="sns:secure" port="" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="add" policySets="sns:secure" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:secure" requires="cns:confidentiality">
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+ <operation name="addCallback" policySets="sns:secure" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+ policySets="sns:secure" requires="cns:confidentiality">
+ <service name="CalculatorService" policySets="sns:secure" requires="cns:confidentiality">
+ <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+ </service>
+
+ <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+ policySets="sns:secure" requires="cns:confidentiality" wiredByImpl="false">
+ <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+ </reference>
+ <reference name="subtractService" target="SubtractServiceComponent" />
+ <reference name="multiplyService" />
+ <reference name="divideService" target="DivideServiceComponent" />
+
+ <property name="round" type="xsd:boolean" many="false">true</property>
+
+ <implementation.java class="calculator.CalculatorServiceImpl" policySets="" requires="" />
+ </component>
+
+ <component name="AddServiceComponent">
+ <service name="AddService">
+ <interface.java interface="calculator.AddService" />
+ </service>
+ <implementation.java class="calculator.AddServiceImpl" />
+ </component>
+
+ <component name="NestedCompositeComponent">
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+ <implementation.composite name="tns:Calculator" />
+ </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>
+
+ <reference name="MultiplyService" promote="CalculatorServiceComponent/multiplyService" policySets="sns:secure"
+ requires="cns:confidentiality">
+ <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+ <operation name="multiply" policySets="sns:secure" requires="cns:confidentiality" />
+
+ <binding.ws name="MultiplyWS" port="" policySets="sns:secure" requires="cns:confidentiality" uri="http://calc/ws">
+ <operation name="multiply" policySets="sns:secure" requires="cns:confidentiality" />
+ </binding.ws>
+
+ <callback policySets="sns:secure" requires="cns:confidentiality">
+ <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" policySets="sns:secure"
+ requires="cns:confidentiality">
+ <operation name="multiplyCallback" policySets="sns:secure" requires="cns:confidentiality" />
+ </binding.ws>
+ </callback>
+ </reference>
+
+ <property name="prop1" xmlns:foo="http://foo">
+ <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
+ <foo:a>AValue</foo:a>
+ <bar:b xmlns:bar="http://bar">InterestingURI</bar:b>
+ </MyComplexPropertyValue1>
+ <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
+ <foo:a>BValue</foo:a>
+ <bar:b xmlns:bar="http://bar">BoringURI</bar:b>
+ </MyComplexPropertyValue2>
+ </property>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
new file mode 100644
index 0000000000..74cb8950a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.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 autowire="false"
+ constrainingType="tns:Calculator"
+ local="true"
+ name="TestAllDivide"
+ policySets="" requires=""
+ targetNamespace="http://calc"
+ xmlns:tns="http://calc"
+ xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+
+ <include>tns:CompleteDivide</include>
+
+ <service name="DivideService" policySets="" promote="CalculatorDivideComponent/DivideService" requires="">
+ <interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+ <operation name="divide" policySets="" requires=""/>
+
+ <binding.ws name="CalculatorWS" policySets="" port="" requires="" uri="http://calc/ws">
+ <operation name="divide" policySets="" requires=""/>
+ </binding.ws>
+
+ <callback policySets="" requires="">
+ <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+ <operation name="divideCallback" policySets="" requires=""/>
+ </binding.ws>
+ </callback>
+ </service>
+
+ <component name="CalculatorDivideComponent" autowire="false" constrainingType="tns:CalculatorServiceComponent" policySets="" requires="">
+ <service name="DivideService" policySets="" requires="">
+ <interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+ </service>
+ <implementation.java class="calculator.DivideImpl" policySets="" requires=""/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.pmd
new file mode 100644
index 0000000000..aa1ce3e754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.pmd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/.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/sca-java-1.x/branches/sca-java-0.90/modules/assembly/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/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/sca-java-1.x/branches/sca-java-0.90/modules/assembly/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/pom.xml
new file mode 100644
index 0000000000..1f119f2efd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-assembly</artifactId>
+ <name>Apache Tuscany Assembly Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
new file mode 100644
index 0000000000..8f371defde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * Interface contracts define one or more business functions. These business
+ * functions are provided by services and are used by references.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractContract extends Base, IntentAttachPoint {
+
+ /**
+ * Returns the name of the contract.
+ *
+ * @return the name of the contract
+ */
+ String getName();
+
+ /**
+ * Sets the name of the contract.
+ *
+ * @param name the name of the contract
+ */
+ void setName(String name);
+
+ /**
+ * Returns the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @return the interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+
+ /**
+ * Returns the interface contract defining the interface and callback
+ * interface for the contract.
+ *
+ * @param interfaceContract the interface contract
+ */
+ void setInterfaceContract(InterfaceContract interfaceContract);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
new file mode 100644
index 0000000000..35c5da4123
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.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.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ */
+public interface AbstractProperty extends Base, IntentAttachPoint {
+
+ /**
+ * Returns the property name.
+ *
+ * @return the property name
+ */
+ String getName();
+
+ /**
+ * Sets the property name.
+ *
+ * @param name the property name
+ */
+ void setName(String name);
+
+ /**
+ * Returns the default value of the property.
+ *
+ * @return the default value of ths property
+ */
+ Object getValue();
+
+ /**
+ * Sets the default value of the property.
+ *
+ * @param defaultValue the default value of ths property
+ */
+ void setValue(Object defaultValue);
+
+ /**
+ * Returns true if the property allows multiple values.
+ *
+ * @return true if the property allows multiple values
+ */
+ boolean isMany();
+
+ /**
+ * Sets whether or not the property allows multiple values.
+ *
+ * @param many true if the property should allow multiple values
+ */
+ void setMany(boolean many);
+
+ /**
+ * Returns true if a value must be supplied for the property.
+ *
+ * @return true is a value must be supplied for the property
+ */
+ boolean isMustSupply();
+
+ /**
+ * Sets whether a value must be supplied for the property.
+ *
+ * @param mustSupply set to true to require that a value be supplied for
+ * uses of this property
+ */
+ void setMustSupply(boolean mustSupply);
+
+ /**
+ * Returns the data type of this property. This is the qualified name of an
+ * XML schema type.
+ *
+ * @return the type of this property
+ */
+ QName getXSDType();
+
+ /**
+ * Sets the data type of this property. This is the qualified name of an XML
+ * schema type.
+ *
+ * @param type the type of this property
+ */
+ void setXSDType(QName type);
+
+ /**
+ * Returns the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @return the element defining the type of this property
+ */
+ QName getXSDElement();
+
+ /**
+ * Sets the element defining the data type of this property. This is the
+ * qualified name of an XML schema element.
+ *
+ * @param type the element defining the type of this property
+ */
+ void setXSDElement(QName element);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
new file mode 100644
index 0000000000..a9ef26bbb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.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.assembly;
+
+/**
+ * Represents a reference contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractReference extends AbstractContract {
+
+ /**
+ * Returns the multiplicity allowed for wires connected to this reference.
+ *
+ * @return the multiplicity allowed for wires connected to this reference
+ */
+ Multiplicity getMultiplicity();
+
+ /**
+ * Sets the multiplicity allowed for wires connected to this reference.
+ *
+ * @param multiplicity the multiplicity allowed for wires connected to this
+ * reference
+ */
+ void setMultiplicity(Multiplicity multiplicity);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
new file mode 100644
index 0000000000..9ae511c07b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.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.assembly;
+
+/**
+ * Represents a service contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AbstractService extends AbstractContract {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
new file mode 100644
index 0000000000..3937d34f92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * A factory for the assembly model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface AssemblyFactory {
+
+ /**
+ * Create a new abstract property.
+ *
+ * @return a new abstract property
+ */
+ AbstractProperty createAbstractProperty();
+
+ /**
+ * Create a new abstract reference.
+ *
+ * @return a new abstract reference
+ */
+ AbstractReference createAbstractReference();
+
+ /**
+ * Create a new abstract service.
+ *
+ * @return a new abstract service
+ */
+ AbstractService createAbstractService();
+
+ /**
+ * Create a new callback.
+ *
+ * @return
+ */
+ Callback createCallback();
+
+ /**
+ * Create a new component.
+ *
+ * @return a new component
+ */
+ Component createComponent();
+
+ /**
+ * Create a new component property.
+ *
+ * @return a new component property
+ */
+ ComponentProperty createComponentProperty();
+
+ /**
+ * Create a new component reference.
+ *
+ * @return a new component reference
+ */
+ ComponentReference createComponentReference();
+
+ /**
+ * Create a new component service.
+ *
+ * @return a new component service
+ */
+ ComponentService createComponentService();
+
+ /**
+ * Create a new component type
+ *
+ * @return a new component type
+ */
+ ComponentType createComponentType();
+
+ /**
+ * Create a new composite.
+ *
+ * @return a new composite
+ */
+ Composite createComposite();
+
+ /**
+ * Create a new composite reference.
+ *
+ * @return a new composite reference
+ */
+ CompositeReference createCompositeReference();
+
+ /**
+ * Create a new composite service.
+ *
+ * @return a new composite service
+ */
+ CompositeService createCompositeService();
+
+ /**
+ * Create a new constraining type.
+ *
+ * @return a new constraining type
+ */
+ ConstrainingType createConstrainingType();
+
+ /**
+ * Create a new property.
+ *
+ * @return a new property
+ */
+ Property createProperty();
+
+ /**
+ * Create a new reference.
+ *
+ * @return a new reference
+ */
+ Reference createReference();
+
+ /**
+ * Create a new service.
+ *
+ * @return a new service
+ */
+ Service createService();
+
+ /**
+ * Create a new wire.
+ *
+ * @return a new wire
+ */
+ Wire createWire();
+
+ /**
+ * Create a new operation.
+ *
+ * @return a new operation
+ */
+ Operation createOperation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
new file mode 100644
index 0000000000..9681ff0c40
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.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.assembly;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Base {
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ List<Object> getExtensions();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
new file mode 100644
index 0000000000..8d7d6958be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.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.assembly;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Binding extends Base, IntentAttachPoint, PolicySetAttachPoint {
+
+ /**
+ * Returns the binding URI.
+ *
+ * @return the binding uri
+ */
+ String getURI();
+
+ /**
+ * Sets the binding URI.
+ *
+ * @param uri the binding uri
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the binding name.
+ *
+ * @return the binding name
+ */
+ String getName();
+
+ /**
+ * Sets the binding name.
+ *
+ * @param name the binding name
+ */
+ void setName(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
new file mode 100644
index 0000000000..b50e4ec06b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a callback object describing the bindings to use for callbacks.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Callback extends Base, IntentAttachPoint, PolicySetAttachPoint {
+
+ /**
+ * Returns the bindings supported for callbacks.
+ *
+ * @return the bindings supported for callbacks
+ */
+ List<Binding> getBindings();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
new file mode 100644
index 0000000000..72ee71de8c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.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.sca.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a component. A component is a configured instance of an
+ * implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Component extends Base, IntentAttachPoint, PolicySetAttachPoint, Visitable {
+
+ /**
+ * Returns the URI of the component.
+ *
+ * @return the URI of the component
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of the component.
+ *
+ * @param uri the URI of the component
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns the name of the component.
+ *
+ * @return the name of the component
+ */
+ String getName();
+
+ /**
+ * Sets the name of the component.
+ *
+ * @param name the name of the component
+ */
+ void setName(String name);
+
+ /**
+ * Returns the component implementation.
+ *
+ * @return the component implementation
+ */
+ Implementation getImplementation();
+
+ /**
+ * Sets the component implementation
+ *
+ * @param implementation the component implementation
+ */
+ void setImplementation(Implementation implementation);
+
+ /**
+ * Returns a list of references used by the component.
+ *
+ * @return a list of references used by the component
+ */
+ List<ComponentReference> getReferences();
+
+ /**
+ * Returns a list of services exposed by the component.
+ *
+ * @return a list of services exposed by the component
+ */
+ List<ComponentService> getServices();
+
+ /**
+ * Returns a list of properties for the component.
+ *
+ * @return a list of properties
+ */
+ List<ComponentProperty> getProperties();
+
+ /**
+ * Returns a constraining type defining the shape of the component.
+ *
+ * @return a constraining type
+ */
+ ConstrainingType getConstrainingType();
+
+ /**
+ * Sets a constraining type defining the shape of the component.
+ *
+ * @param constrainingType the constraining type
+ */
+ void setConstrainingType(ConstrainingType constrainingType);
+
+ /**
+ * Returns true if the component references should be autowired.
+ *
+ * @return whether component references should be autowired.
+ */
+ boolean isAutowire();
+
+ /**
+ * Sets whether component references should be autowired.
+ *
+ * @param autowire whether component references should be autowired
+ */
+ void setAutowire(boolean autowire);
+
+ /**
+ * Returns a clone of the component.
+ *
+ * @return a clone of the component
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
new file mode 100644
index 0000000000..9a344afb09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.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.assembly;
+
+/**
+ * Represents a configured property of a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentProperty extends Property, Cloneable {
+
+ /**
+ * Returns the property defined by the component implementation.
+ *
+ * @return the property defined by the component implementation
+ */
+ Property getProperty();
+
+ /**
+ * Sets the property type that defines this property.
+ *
+ * @param type the property that defines this property
+ */
+ void setProperty(Property property);
+
+ /**
+ * Returns an xpath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @return an xpath expression referencing a property of the enclosing
+ * composite
+ */
+ String getSource();
+
+ /**
+ * Sets an xpath expression referencing a property of the enclosing
+ * composite.
+ *
+ * @param source an xpath expression referencing a property of the enclosing
+ * composite
+ */
+ void setSource(String source);
+
+ /**
+ * Returns a URI to a file containing the property value.
+ *
+ * @return a URI to a file containing the property value
+ */
+ String getFile();
+
+ /**
+ * Sets a URI to a file containing the property value.
+ *
+ * @param file a URI to a file containing the property value
+ */
+ void setFile(String file);
+
+ /**
+ * Clone the component property.
+ *
+ * @return a clone of the component property
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
new file mode 100644
index 0000000000..1f4b4f0801
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.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.assembly;
+
+
+/**
+ * An instance of a reference associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentReference extends Reference {
+
+ /**
+ * Returns the reference defined by the implementation for this reference.
+ *
+ * @return
+ */
+ Reference getReference();
+
+ /**
+ * Sets the reference defined by the implementation for this reference.
+ *
+ * @param reference
+ */
+ void setReference(Reference reference);
+
+ /**
+ * Returns true if the reference should be autowired.
+ *
+ * @return whether the reference should be autowired.
+ */
+ boolean isAutowire();
+
+ /**
+ * Sets whether the reference should be autowired.
+ *
+ * @param autowire whether the reference should be autowired
+ */
+ void setAutowire(boolean autowire);
+
+
+ /**
+ * Clone the component reference.
+ *
+ * @return a clone of the component reference
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
new file mode 100644
index 0000000000..c0e42dbb93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.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.assembly;
+
+
+/**
+ * An addressable instance of a service associated with a particular component.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentService extends Service {
+
+ /**
+ * Returns the service defined by the implementation for this service.
+ *
+ * @return
+ */
+ Service getService();
+
+ /**
+ * Sets the service defined by the implementation for this service.
+ *
+ * @param service
+ */
+ void setService(Service service);
+
+ /**
+ * Clone the component service.
+ *
+ * @return a clone of the component service
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
new file mode 100644
index 0000000000..ffdef42aed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Describes an implementation and represents its configurable aspects.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentType extends Base, IntentAttachPoint, PolicySetAttachPoint {
+
+ /**
+ * Returns the URI of this component type.
+ * @return the URI of the component type
+ */
+ String getURI();
+
+ /**
+ * Sets the URI of this component type.
+ * @param uri the URI of the component type
+ */
+ void setURI(String uri);
+
+ /**
+ * Returns a list of services that are offered.
+ *
+ * @return a list of services that are offered
+ */
+ List<Service> getServices();
+
+ /**
+ * Returns the list of reference types that are used.
+ *
+ * @return the list of reference types that are used
+ */
+ List<Reference> getReferences();
+
+ /**
+ * Returns the list of properties that can be set.
+ *
+ * @return the list of properties that can be set
+ */
+ List<Property> getProperties();
+
+ /**
+ * Returns a constraining type defining the shape of the implementation.
+ *
+ * @return a constraining type
+ */
+ ConstrainingType getConstrainingType();
+
+ /**
+ * Sets a constraining type defining the shape of the implementation.
+ *
+ * @param constrainingType the constraining type to set
+ */
+ void setConstrainingType(ConstrainingType constrainingType);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
new file mode 100644
index 0000000000..1fe402d829
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.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.sca.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Represents a composite.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Composite extends Implementation, Visitable {
+
+ /**
+ * Returns the name of the composite.
+ *
+ * @return the name of the composite
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the composite.
+ *
+ * @param name the name of the composite
+ */
+ void setName(QName name);
+
+ /**
+ * Returns a list of composites included in this composite.
+ *
+ * @return a list of composites included in this composite.
+ */
+ List<Composite> getIncludes();
+
+ /**
+ * Returns a list of components contained in this composite.
+ *
+ * @return a list of components contained in this composite
+ */
+ List<Component> getComponents();
+
+ /**
+ * Returns a list of wires contained in this composite.
+ *
+ * @return a list of wires contained in this composite
+ */
+ List<Wire> getWires();
+
+ /**
+ * Returns true if all the components within the composite must run in the
+ * same process.
+ *
+ * @return true if all the components within the composite must run in the
+ * same process
+ */
+ boolean isLocal();
+
+ /**
+ * Sets whether all the components within the composite must run in the same
+ * process.
+ *
+ * @param local whether all the components within the composite must run in
+ * the same process
+ */
+ void setLocal(boolean local);
+
+ /**
+ * Returns true if autowiring is enabled in the composite.
+ *
+ * @return true if autowiring is enabled in the composite
+ */
+ boolean isAutowire();
+
+ /**
+ * Sets whether autowiring is enabled in the composite.
+ *
+ * @param autowire whether autowiring is enabled in the composite
+ */
+ void setAutowire(boolean autowire);
+
+ /**
+ * Returns a clone of the component type.
+ *
+ * @return a clone of the component type
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
new file mode 100644
index 0000000000..d3fa80ba74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.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.assembly;
+
+import java.util.List;
+
+/**
+ * Represents composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeReference extends Reference {
+
+ /**
+ * Returns the promoted composite references.
+ *
+ * @return the promoted composite references
+ */
+ List<ComponentReference> getPromotedReferences();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
new file mode 100644
index 0000000000..757e2bda2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.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.sca.assembly;
+
+/**
+ * Represents a composite service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeService extends Service {
+
+ /**
+ * Returns the promoted component service .
+ *
+ * @return the promoted component service.
+ */
+ ComponentService getPromotedService();
+
+ /**
+ * Sets the promoted component service
+ *
+ * @param promotedService the promoted component service.
+ */
+ void setPromotedService(ComponentService promotedService);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
new file mode 100644
index 0000000000..4119d0a268
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.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.assembly;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+
+/**
+ * A constrainingType provides the "shape" for a component and its
+ * implementation. Any component configuration that points to a constrainingType
+ * is constrained by this shape. The constrainingType specifies the services,
+ * references and properties that must be implemented.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ConstrainingType extends Base, IntentAttachPoint {
+
+ /**
+ * Returns the name of the constrainingType.
+ *
+ * @return the name of the constrainingType
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the constrainingType.
+ *
+ * @param name the name of the constrainingType
+ */
+ void setName(QName name);
+
+ /**
+ * Returns a list of services that are offered.
+ *
+ * @return a list of services that are offered
+ */
+ List<AbstractService> getServices();
+
+ /**
+ * Returns the list of references that are used.
+ *
+ * @return the list of references that are used
+ */
+ List<AbstractReference> getReferences();
+
+ /**
+ * Returns the list of properties that can be set.
+ *
+ * @return the list of properties that can be set
+ */
+ List<AbstractProperty> getProperties();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
new file mode 100644
index 0000000000..830ede478a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a contract. A contract can be either a service or a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Contract extends AbstractContract, PolicySetAttachPoint {
+
+ /**
+ * Returns the bindings supported by this contract.
+ *
+ * @return the bindings supported by this contract
+ */
+ List<Binding> getBindings();
+
+ /**
+ * Returns a binding of the specified type or null if there is no such
+ * binding configured on this contract.
+ *
+ * @param <B> the binding type
+ * @param bindingClass the binding type class
+ * @return the binding or null if there is no binding of the specified type
+ */
+ <B> B getBinding(Class<B> bindingClass);
+
+ /**
+ * Returns a callback definition of the bindings to use for callbacks.
+ *
+ * @return a definition of the bindings to use for callbacks
+ */
+ Callback getCallback();
+
+ /**
+ * Sets a callback definition of the bindings to use for callbacks
+ *
+ * @param callback a definition of the bindings to use for callbacks
+ */
+ void setCallback(Callback callback);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
new file mode 100644
index 0000000000..5dd256e3c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.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.assembly;
+
+import org.apache.tuscany.sca.assembly.impl.AssemblyFactoryImpl;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultSCABindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultSCABindingFactory.java
new file mode 100644
index 0000000000..793a8f960b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultSCABindingFactory.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.assembly;
+
+import org.apache.tuscany.sca.assembly.impl.SCABindingFactoryImpl;
+
+/**
+ * A factory for the SCA binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCABindingFactory extends SCABindingFactoryImpl implements SCABindingFactory {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
new file mode 100644
index 0000000000..e79f9bccdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.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.assembly;
+
+/**
+ * Represents a component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Implementation extends ComponentType {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
new file mode 100644
index 0000000000..5d15ce9938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.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.assembly;
+
+/**
+ * Enumeration for multiplicity. Defines the number of wires that can connect a
+ * reference to target services.
+ *
+ * @version $Rev$ $Date$
+ */
+public enum Multiplicity {
+
+ /**
+ * Zero or one wire can have the reference as a source.
+ */
+ ZERO_ONE,
+
+ /**
+ * The default setting, one wire can have the reference as a source.
+ */
+ ONE_ONE,
+
+ /**
+ * Zero or more wires can have the reference as a source.
+ */
+ ZERO_N,
+
+ /**
+ * One or more wires can have the reference as a source.
+ */
+ ONE_N
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
new file mode 100644
index 0000000000..98089d66cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.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.sca.assembly;
+
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A property allows for the configuration of an implementation with externally
+ * set data values. An implementation can have zero or more properties. Each
+ * property has a data type, which may be either simple or complex. An
+ * implementation may also define a default value for a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Property extends AbstractProperty, PolicySetAttachPoint {
+
+ /**
+ * Returns a clone of the property.
+ *
+ * @return a clone of the property
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
new file mode 100644
index 0000000000..3b2d2b124c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.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.assembly;
+
+import java.util.List;
+
+/**
+ * Represents a reference. References within an implementation represent links
+ * to services that the implementation uses that must be provided by other
+ * components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Reference extends AbstractReference, Contract {
+
+ /**
+ * Returns a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @return true if the implementation wires this reference dynamically
+ */
+ boolean isWiredByImpl();
+
+ /**
+ * Sets a boolean value, "false" by default, which indicates that the
+ * implementation wires this reference dynamically.
+ *
+ * @param wiredByImpl whether the implementation wires this reference
+ * dynamically
+ */
+ void setWiredByImpl(boolean wiredByImpl);
+
+ /**
+ * Returns the targets of this reference.
+ *
+ * @return the targets of this reference.
+ */
+ List<ComponentService> getTargets();
+
+ /**
+ * Returns a clone of the reference.
+ *
+ * @return a clone of the reference
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
new file mode 100644
index 0000000000..eaf60aa6d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.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.sca.assembly;
+
+/**
+ * Represents an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABinding extends Binding {
+
+ Component getComponent();
+
+ void setComponent(Component component);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
new file mode 100644
index 0000000000..0abfd13d10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.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.assembly;
+
+
+/**
+ * A factory for the SCA binding model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface SCABindingFactory {
+
+ /**
+ * Create a new SCA binding.
+ *
+ * @return a new SCA binding
+ */
+ SCABinding createSCABinding();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
new file mode 100644
index 0000000000..ea32efb769
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.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.assembly;
+
+/**
+ * Represents a service. Services are used to publish services provided by
+ * implementations, so that they are addressable by other components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Service extends AbstractService, Contract {
+
+ /**
+ * Returns a clone of the service.
+ *
+ * @return a clone of the service
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitable.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitable.java
new file mode 100644
index 0000000000..6d3998b79e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitable.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.assembly;
+
+/**
+ * This interface is implemented by object that can accept a visitor.
+ */
+public interface Visitable {
+
+ /**
+ * Accepts the given visitor. The visitor's visit method is called with this
+ * model object. If the visitor returns true, this method visits this
+ * object's children.
+ *
+ * @param visitor
+ * @return true if the model object's chidren should be visited, false if
+ * they should be skipped
+ */
+ boolean accept(Visitor visitor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitor.java
new file mode 100644
index 0000000000..a15354e401
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Visitor.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.assembly;
+
+
+/**
+ * This interface is implemented by objects that visit assembly model trees.
+ */
+public interface Visitor {
+
+ /**
+ * Visits the given assembly model object.
+ *
+ * @param object
+ * @return true if the model object's chidren should be visited, false if
+ * they should be skipped
+ */
+ boolean visit(Base object);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
new file mode 100644
index 0000000000..58562eb5ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.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.sca.assembly;
+
+import org.apache.tuscany.sca.policy.IntentAttachPoint;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * Represents a wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Wire extends Base, IntentAttachPoint, PolicySetAttachPoint {
+
+ /**
+ * Returns the source of the wire.
+ *
+ * @return the source of the wire
+ */
+ ComponentReference getSource();
+
+ /**
+ * Sets the source of the wire.
+ *
+ * @param source the source of the wire
+ */
+ void setSource(ComponentReference source);
+
+ /**
+ * Returns the target of the wire.
+ *
+ * @return the target of the wire
+ */
+ ComponentService getTarget();
+
+ /**
+ * Sets the target of the wire.
+ *
+ * @param target the target of the wire
+ */
+ void setTarget(ComponentService target);
+
+ /**
+ * Returns a clone of the wire.
+ *
+ * @return a clone of the wire
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
new file mode 100644
index 0000000000..26bdc3cffa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.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.assembly.builder;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeBuilder {
+
+ /**
+ * Build, configure and wire a composite.
+ *
+ * @param composite
+ * @throws CompositeBuilderException
+ */
+ void build(Composite composite) throws CompositeBuilderException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
new file mode 100644
index 0000000000..5a2015f55e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.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.assembly.builder;
+
+/**
+ * Reports a composite builder exception.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderException extends Exception {
+ private static final long serialVersionUID = -8916323176803443856L;
+
+ public CompositeBuilderException() {
+ }
+
+ public CompositeBuilderException(String message) {
+ super(message);
+ }
+
+ public CompositeBuilderException(Throwable cause) {
+ super(cause);
+ }
+
+ public CompositeBuilderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.java
new file mode 100644
index 0000000000..aecdf417f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderMonitor.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.assembly.builder;
+
+/**
+ * A monitor for the composite builder.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeBuilderMonitor {
+
+ /**
+ * Reports a build problem.
+ *
+ * @param problem
+ */
+ void problem(Problem problem);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.java
new file mode 100644
index 0000000000..8965410438
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Problem.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.assembly.builder;
+
+
+/**
+ * Reports a composite assembly problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Problem {
+
+ public enum Severity {
+ INFO,
+ WARNING,
+ ERROR
+ }
+
+ Severity getSeverity();
+
+ String getMessage();
+
+ Object getModel();
+
+ Object getResource();
+
+ Exception getCause();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
new file mode 100644
index 0000000000..dbb0674522
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
@@ -0,0 +1,1340 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.builder.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.Problem.Severity;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+
+/**
+ * A builder that handles the configuration of the components inside a
+ * composite and the wiring of component references to component services.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeBuilderImpl implements CompositeBuilder {
+
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private InterfaceContractMapper interfaceContractMapper;
+ private CompositeBuilderMonitor monitor;
+
+ /**
+ * Constructs a new composite util.
+ *
+ * @param assemblyFactory
+ * @param interfaceContractMapper
+ */
+ public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ CompositeBuilderMonitor monitor) {
+ this.assemblyFactory = assemblyFactory;
+ this.scaBindingFactory = scaBindingFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+
+ if (monitor != null) {
+ this.monitor = monitor;
+ } else {
+ // Create a default monitor that does nothing.
+ this.monitor = new CompositeBuilderMonitor() {
+ public void problem(Problem problem) {
+ }
+ };
+ }
+ }
+
+ public void build(Composite composite) throws CompositeBuilderException {
+
+ // Collect and fuse includes
+ fuseIncludes(composite);
+
+ // Expand nested composites
+ expandComposites(composite);
+
+ // Configure all components
+ configureComponents(composite);
+
+ // Wire the composite
+ wireComposite(composite);
+
+ // Activate composite services
+ activateCompositeServices(composite);
+
+ // Wire composite references
+ wireCompositeReferences(composite);
+ }
+
+ /**
+ * Collect all includes in a graph of includes.
+ *
+ * @param composite
+ * @param includes
+ */
+ private void collectIncludes(Composite composite, List<Composite> includes) {
+ for (Composite include : composite.getIncludes()) {
+ includes.add(include);
+ collectIncludes(include, includes);
+ }
+ }
+
+ /**
+ * Copy a list of includes into a composite.
+ *
+ * @param composite
+ * @param includes
+ */
+ protected void fuseIncludes(Composite composite) {
+
+ // First collect all includes
+ List<Composite> includes = new ArrayList<Composite>();
+ collectIncludes(composite, includes);
+
+ // Then clone them
+ for (Composite include : includes) {
+ Composite clone;
+ try {
+ clone = (Composite)include.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ composite.getComponents().addAll(clone.getComponents());
+ composite.getServices().addAll(clone.getServices());
+ composite.getReferences().addAll(clone.getReferences());
+ composite.getProperties().addAll(clone.getProperties());
+ composite.getWires().addAll(clone.getWires());
+ composite.getPolicySets().addAll(clone.getPolicySets());
+ composite.getRequiredIntents().addAll(clone.getRequiredIntents());
+ }
+
+ // Clear the list of includes
+ composite.getIncludes().clear();
+ }
+
+ /**
+ * Reconcile component services and services defined on the component type.
+ *
+ * @param component
+ * @param services
+ * @param componentServices
+ * @param problems
+ */
+ private void reconcileServices(Component component,
+ Map<String, Service> services,
+ Map<String, ComponentService> componentServices) {
+
+ // Connect each component service to the corresponding service
+ for (ComponentService componentService : component.getServices()) {
+ Service service = services.get(componentService.getName());
+ if (service != null) {
+ componentService.setService(service);
+ } else {
+ warning("Service not found for component service: " + component.getName() + "/" + componentService.getName(), component);
+ }
+ }
+
+ // Create a component service for each service
+ if (component.getImplementation() != null) {
+ for (Service service : component.getImplementation().getServices()) {
+ if (!componentServices.containsKey(service.getName())) {
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setName(service.getName());
+ componentService.setService(service);
+ component.getServices().add(componentService);
+ }
+ }
+ }
+
+ // Reconcile each component service with its service
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+
+ // Reconcile interface
+ if (componentService.getInterfaceContract() != null) {
+ if (!componentService.getInterfaceContract().equals(service.getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(componentService.getInterfaceContract(), service
+ .getInterfaceContract())) {
+ warning("Component service interface incompatible with service interface: " + component.getName() + "/" + componentService.getName(), component);
+ }
+ }
+ } else {
+ componentService.setInterfaceContract(service.getInterfaceContract());
+ }
+
+ // Reconcile bindings
+ if (componentService.getBindings().isEmpty()) {
+ componentService.getBindings().addAll(service.getBindings());
+ }
+ }
+
+ }
+ }
+
+ /**
+ * Reconcile component references with the references defined on the
+ * component type.
+ *
+ * @param component
+ * @param references
+ * @param componentReferences
+ * @param problems
+ */
+ private void reconcileReferences(Component component,
+ Map<String, Reference> references,
+ Map<String, ComponentReference> componentReferences) {
+
+ // Connect each component reference to the corresponding reference
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = references.get(componentReference.getName());
+ if (reference != null) {
+ componentReference.setReference(reference);
+ } else {
+ if (!componentReference.getName().startsWith("$self$.")) {
+ warning("Reference not found for component reference: " + component.getName() + "/" + componentReference.getName(), component);
+ }
+ }
+ }
+
+ // Create a component reference for each reference
+ if (component.getImplementation() != null) {
+ for (Reference reference : component.getImplementation().getReferences()) {
+ if (!componentReferences.containsKey(reference.getName())) {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName(reference.getName());
+ componentReference.setReference(reference);
+ component.getReferences().add(componentReference);
+ }
+ }
+ }
+
+ // Reconcile each component reference with its reference
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+
+ // Reconcile multiplicity
+ if (componentReference.getMultiplicity() != null) {
+ if (!ReferenceUtil.isValidMultiplicityOverride(reference.getMultiplicity(), componentReference
+ .getMultiplicity())) {
+ warning("Component reference multiplicity incompatible with reference multiplicity: " + component.getName() + "/" + componentReference.getName(), component);
+ }
+ } else {
+ componentReference.setMultiplicity(reference.getMultiplicity());
+ }
+
+ // Reconcile interface
+ if (componentReference.getInterfaceContract() != null) {
+ if (!componentReference.getInterfaceContract().equals(reference.getInterfaceContract())) {
+ if (!interfaceContractMapper.isCompatible(reference.getInterfaceContract(), componentReference
+ .getInterfaceContract())) {
+ warning("Component reference interface incompatible with reference interface: " + component.getName() + "/" + componentReference.getName(), component);
+ }
+ }
+ } else {
+ componentReference.setInterfaceContract(reference.getInterfaceContract());
+ }
+
+ // Reconcile bindings
+ if (componentReference.getBindings().isEmpty()) {
+ componentReference.getBindings().addAll(reference.getBindings());
+ }
+
+ // Propagate autowire setting from the component
+ if (component.isAutowire()) {
+ componentReference.setAutowire(true);
+ }
+
+ // Reconcile targets
+ if (componentReference.getTargets().isEmpty()) {
+ componentReference.getTargets().addAll(reference.getTargets());
+ }
+ }
+ }
+ }
+
+ /**
+ * Reconcile component properties and the properties defined by the
+ * component type.
+ *
+ * @param component
+ * @param properties
+ * @param componentProperties
+ * @param problems
+ */
+ private void reconcileProperties(Component component,
+ Map<String, Property> properties,
+ Map<String, ComponentProperty> componentProperties) {
+
+ // Connect component properties to their properties
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ Property property = properties.get(componentProperty.getName());
+ if (property != null) {
+ componentProperty.setProperty(property);
+ } else {
+ warning("Property not found for component property: " + component.getName() + "/" + componentProperty.getName(), component);
+ }
+ }
+
+ // Create component properties for all properties
+ if (component.getImplementation() != null) {
+ for (Property property : component.getImplementation().getProperties()) {
+ if (!componentProperties.containsKey(property.getName())) {
+ ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
+ componentProperty.setName(property.getName());
+ componentProperty.setMany(property.isMany());
+ componentProperty.setXSDElement(property.getXSDElement());
+ componentProperty.setXSDType(property.getXSDType());
+ componentProperty.setProperty(property);
+ component.getProperties().add(componentProperty);
+ }
+ }
+ }
+
+ // Reconcile component properties and their properties
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ Property property = componentProperty.getProperty();
+ if (property != null) {
+
+ // Check that a component property does not override the
+ // mustSupply attribute
+ if (!property.isMustSupply() && componentProperty.isMustSupply()) {
+ warning("Component property mustSupply attribute incompatible with property: " + component.getName() + "/" + componentProperty.getName(), component);
+ }
+
+ // Default to the mustSupply attribute specified on the property
+ if (!componentProperty.isMustSupply())
+ componentProperty.setMustSupply(property.isMustSupply());
+
+ // Default to the value specified on the property
+ if (componentProperty.getValue() == null) {
+ componentProperty.setValue(property.getValue());
+ }
+
+ // Check that a value is supplied
+ if (componentProperty.getValue() == null && property.isMustSupply()) {
+ warning("No value configured on a mustSupply property: " + component.getName() + "/" + componentProperty.getName(), component);
+ }
+
+ // Check that a a component property does not override the
+ // many attribute
+ if (!property.isMany() && componentProperty.isMany()) {
+ warning("Component property many attribute incompatible with property: " + component.getName() + "/" + componentProperty.getName(), component);
+ }
+
+ // Default to the many attribute defined on the property
+ componentProperty.setMany(property.isMany());
+
+ // Default to the type and element defined on the property
+ if (componentProperty.getXSDType() == null) {
+ componentProperty.setXSDType(property.getXSDType());
+ }
+ if (componentProperty.getXSDElement() == null) {
+ componentProperty.setXSDElement(property.getXSDElement());
+ }
+
+ // Check that a type or element are specified
+ if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
+ warning("No type specified on component property: " + component.getName() + "/" + componentProperty.getName(), component);
+ }
+ }
+ }
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void configureComponents(Composite composite) {
+ configureComponents(composite, null);
+ }
+
+ private void indexImplPropServRef(Component component,
+ Map<String, Service> services,
+ Map<String, Reference> references,
+ Map<String, Property> properties) {
+ // First check that the component has a resolved implementation
+ Implementation implementation = component.getImplementation();
+ if (implementation == null) {
+
+ // A component must have an implementation
+ warning("No implementation for component: " + component.getName(), component);
+
+ } else if (implementation.isUnresolved()) {
+
+ // The implementation must be fully resolved
+ warning("Component implementation not found: " + component.getName()
+ + " : "
+ + implementation.getURI(), component);
+
+ } else {
+
+ // Index properties, services and references, also check for
+ // duplicates
+ for (Property property : implementation.getProperties()) {
+ if (properties.containsKey(property.getName())) {
+ warning("Duplicate property name: " + component.getName()
+ + "/"
+ + property.getName(), component);
+ } else {
+ properties.put(property.getName(), property);
+ }
+ }
+ for (Service service : implementation.getServices()) {
+ if (services.containsKey(service.getName())) {
+ warning("Duplicate service name: " + component.getName()
+ + "/"
+ + service.getName(), component);
+ } else {
+ services.put(service.getName(), service);
+ }
+ }
+ for (Reference reference : implementation.getReferences()) {
+ if (references.containsKey(reference.getName())) {
+ warning("Duplicate reference name: " + component.getName()
+ + "/"
+ + reference.getName(), component);
+ } else {
+ references.put(reference.getName(), reference);
+ }
+ }
+ }
+
+ }
+
+ private void indexCompPropServRef(Component component,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences,
+ Map<String, ComponentProperty> componentProperties) {
+ for (ComponentService componentService : component.getServices()) {
+ if (componentServices.containsKey(componentService.getName())) {
+ warning("Duplicate component service name: " + component.getName()
+ + "/"
+ + componentService.getName(), component);
+ } else {
+ componentServices.put(componentService.getName(), componentService);
+ }
+
+ // Initialize binding names
+ for (Binding binding : componentService.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentService.getName());
+ }
+ }
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ if (componentReferences.containsKey(componentReference.getName())) {
+ warning("Duplicate component reference name: " + component.getName()
+ + "/"
+ + componentReference.getName(), component);
+ } else {
+ componentReferences.put(componentReference.getName(), componentReference);
+ }
+
+ // Initialize binding names
+ for (Binding binding : componentReference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(componentReference.getName());
+ }
+ }
+ }
+ for (ComponentProperty componentProperty : component.getProperties()) {
+ if (componentProperties.containsKey(componentProperty.getName())) {
+ warning("Duplicate component property name: " + component.getName()
+ + "/"
+ + componentProperty.getName(), component);
+ } else {
+ componentProperties.put(componentProperty.getName(), componentProperty);
+ }
+ }
+
+ }
+
+ /**
+ * Configure components in the composite.
+ *
+ * @param composite
+ * @param uri
+ * @param problems
+ */
+ private void configureComponents(Composite composite, String uri) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+
+ // Initialize component URI
+ String componentURI;
+ if (uri == null) {
+ componentURI = component.getName();
+ } else {
+ componentURI = uri + "/" + component.getName();
+ }
+ component.setURI(componentURI);
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // Process nested composite
+ configureComponents((Composite)implementation, componentURI);
+ }
+ }
+
+ // Set default binding names
+ for (Service service : composite.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(service.getName());
+ }
+ }
+ }
+ for (Reference reference : composite.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ if (binding.getName() == null) {
+ binding.setName(reference.getName());
+ }
+ }
+ }
+
+ // Initialize all component services and references
+ Map<String, Component> components = new HashMap<String, Component>();
+ for (Component component : composite.getComponents()) {
+
+ // Index all components and check for duplicates
+ if (components.containsKey(component.getName())) {
+ warning("Duplicate component name: " + composite.getName() + " : " + component.getName(), composite);
+ } else {
+ components.put(component.getName(), component);
+ }
+
+ // Propagate the autowire flag from the composite to components
+ if (composite.isAutowire()) {
+ component.setAutowire(true);
+ }
+
+
+ Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Reference> references = new HashMap<String, Reference>();
+ Map<String, Property> properties = new HashMap<String, Property>();
+ //Index properties, services and references
+ indexImplPropServRef(component, services, references, properties);
+
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+ Map<String, ComponentProperty> componentProperties = new HashMap<String, ComponentProperty>();
+ //Index component services, references and properties
+ // Also check for duplicates
+ indexCompPropServRef(component, componentServices, componentReferences, componentProperties);
+
+ // Reconcile component services/references/properties and
+ // implementation
+ // services/references and create component
+ // services/references/properties
+ // for the services/references declared by the implementation
+ reconcileServices(component, services, componentServices);
+ reconcileReferences(component, references, componentReferences);
+ reconcileProperties(component, properties, componentProperties);
+
+ // Create self references to the component's services
+ if (!(component.getImplementation() instanceof Composite)) {
+ createSelfReferences(component);
+ }
+ }
+ }
+
+ /**
+ * Create SCA bindings for component services and references.
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void createSCABindings(Composite composite,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ for (Component component : composite.getComponents()) {
+ int i = 0;
+ for (ComponentService componentService : component.getServices()) {
+ String uri = component.getName() + '/' + componentService.getName();
+ componentServices.put(uri, componentService);
+ if (i == 0) {
+ componentServices.put(component.getName(), componentService);
+ }
+ i++;
+
+ // Create and configure an SCA binding for the service
+ SCABinding scaBinding = componentService.getBinding(SCABinding.class);
+ if (scaBinding == null) {
+ scaBinding = scaBindingFactory.createSCABinding();
+ scaBinding.setName(componentService.getName());
+ componentService.getBindings().add(scaBinding);
+ }
+ scaBinding.setURI(uri);
+ scaBinding.setComponent(component);
+ }
+ for (ComponentReference componentReference : component.getReferences()) {
+ String uri = component.getName() + '/' + componentReference.getName();
+ componentReferences.put(uri, componentReference);
+
+ // Create and configure an SCA binding for the reference
+ SCABinding scaBinding = componentReference.getBinding(SCABinding.class);
+ if (scaBinding == null) {
+ scaBinding = scaBindingFactory.createSCABinding();
+ scaBinding.setName(componentReference.getName());
+ componentReference.getBindings().add(scaBinding);
+ }
+ scaBinding.setURI(uri);
+ scaBinding.setComponent(component);
+ }
+ }
+
+ }
+
+ /**
+ * Connect composite services to the component services that they promote.
+ *
+ * @param composite
+ * @param componentServices
+ * @param problems
+ */
+ private void connectCompositeServices(Composite composite,
+ Map<String, ComponentService> componentServices) {
+
+ // Propagate interfaces from inner composite components' services to
+ // their component services
+ for (Component component : composite.getComponents()) {
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ Service service = componentService.getService();
+ if (service != null) {
+ if (componentService.getInterfaceContract() == null) {
+ componentService.setInterfaceContract(service.getInterfaceContract());
+ }
+ }
+ }
+ }
+ }
+
+ // Connect composite services to the component services that they
+ // promote
+ for (Service service : composite.getServices()) {
+
+ CompositeService compositeService = (CompositeService)service;
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null && componentService.isUnresolved()) {
+ ComponentService promotedService = componentServices.get(componentService.getName());
+ if (promotedService != null) {
+
+ // Point to the resolved component service
+ compositeService.setPromotedService(promotedService);
+
+ // Use the interface contract from the component service if
+ // none is specified on the composite service
+ if (compositeService.getInterfaceContract() == null) {
+ compositeService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+
+ } else {
+ warning("Promoted component service not found: " + componentService.getName(), composite);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Resolves promoted references.
+ *
+ * @param composite
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectCompositeReferences(Composite composite,
+ Map<String, ComponentReference> componentReferences) {
+
+ // Propagate interfaces from inner composite components' references to
+ // their component references
+ for (Component component : composite.getComponents()) {
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference != null) {
+ if (componentReference.getInterfaceContract() == null) {
+ componentReference.setInterfaceContract(reference.getInterfaceContract());
+ }
+ }
+ }
+ }
+ }
+
+ // Connect composite references to the component references
+ // that they promote
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
+ for (int i = 0, n = promotedReferences.size(); i < n; i++) {
+ ComponentReference componentReference = promotedReferences.get(i);
+ if (componentReference.isUnresolved()) {
+ String componentReferenceName = componentReference.getName();
+ componentReference = componentReferences.get(componentReferenceName);
+ if (componentReference != null) {
+
+ // Point to the resolved component reference
+ promotedReferences.set(i, componentReference);
+
+ // Use the interface contract from the component
+ // reference if none
+ // is specified on the composite reference
+ if (compositeReference.getInterfaceContract() == null) {
+ compositeReference.setInterfaceContract(componentReference.getInterfaceContract());
+ }
+
+ } else {
+ warning("Promoted component reference not found: " + componentReferenceName, composite);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Connect references to their targets.
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectComponentReferences(Composite composite,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ for (ComponentReference componentReference : componentReferences.values()) {
+ List<ComponentService> targets = componentReference.getTargets();
+
+ if (componentReference.isAutowire()) {
+
+ // Find suitable targets in the current composite for an
+ // autowired reference
+ Multiplicity multiplicity = componentReference.getMultiplicity();
+ for (Component component : composite.getComponents()) {
+ for (ComponentService componentService : component.getServices()) {
+ if (componentReference.getInterfaceContract() == null || interfaceContractMapper
+ .isCompatible(componentReference.getInterfaceContract(), componentService
+ .getInterfaceContract())) {
+
+ targets.add(componentService);
+ if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
+ break;
+ }
+ }
+ }
+ }
+
+ } else if (!targets.isEmpty()) {
+
+ // Resolve targets specified on the component reference
+ for (int i = 0, n = targets.size(); i < n; i++) {
+ ComponentService target = targets.get(i);
+ if (target.isUnresolved()) {
+ ComponentService resolved = componentServices.get(target.getName());
+ if (resolved != null) {
+
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (componentReference.getInterfaceContract() == null || interfaceContractMapper
+ .isCompatible(componentReference.getInterfaceContract(), resolved
+ .getInterfaceContract())) {
+
+ targets.set(i, resolved);
+ } else {
+ warning("Incompatible interfaces on component reference and target: " + componentReference.getName() + " : " + target.getName(), composite);
+ }
+ } else {
+ warning("Component reference target not found: " + target.getName(), composite);
+ }
+ }
+ }
+ } else if (componentReference.getReference() != null) {
+
+ // Resolve targets from the corresponding reference in the
+ // componentType
+ for (ComponentService target : componentReference.getReference().getTargets()) {
+ if (target.isUnresolved()) {
+ ComponentService resolved = componentServices.get(target.getName());
+ if (resolved != null) {
+
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (componentReference.getInterfaceContract() == null || interfaceContractMapper
+ .isCompatible(componentReference.getInterfaceContract(), resolved
+ .getInterfaceContract())) {
+
+ targets.add(resolved);
+ } else {
+ warning("Incompatible interfaces on component reference and target: " + componentReference.getName() + " : " + target.getName(), composite);
+ }
+ } else {
+ warning("Reference target not found: " + target.getName(), composite);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Resolve wires and connect the sources to their targets
+ *
+ * @param composite
+ * @param componentServices
+ * @param componentReferences
+ * @param problems
+ */
+ private void connectWires(Composite composite,
+ Map<String, ComponentService> componentServices,
+ Map<String, ComponentReference> componentReferences) {
+
+ // For each wire, resolve the source reference, the target service, and
+ // add it to the list of targets of the reference
+ List<Wire> wires = composite.getWires();
+ for (int i = 0, n = wires.size(); i < n; i++) {
+ Wire wire = wires.get(i);
+
+ ComponentReference resolvedReference;
+ ComponentService resolvedService;
+
+ // Resolve the source reference
+ ComponentReference source = wire.getSource();
+ if (source != null && source.isUnresolved()) {
+ resolvedReference = componentReferences.get(source.getName());
+ if (resolvedReference != null) {
+ wire.setSource(resolvedReference);
+ } else {
+ warning("Wire source not found: " + source.getName(), composite);
+ }
+ } else {
+ resolvedReference = wire.getSource();
+ }
+
+ // Resolve the target service
+ ComponentService target = wire.getTarget();
+ if (target != null && target.isUnresolved()) {
+ resolvedService = componentServices.get(target.getName());
+ if (resolvedService != null) {
+ wire.setTarget(target);
+ } else {
+ warning("Wire target not found: " + source.getName(), composite);
+ }
+ } else {
+ resolvedService = wire.getTarget();
+ }
+
+ // Add the target service to the list of targets of the
+ // reference
+ if (resolvedReference != null && resolvedService != null) {
+ // Check that the target component service provides
+ // a superset of
+ // the component reference interface
+ if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper
+ .isCompatible(resolvedReference.getInterfaceContract(), resolvedService
+ .getInterfaceContract())) {
+
+ resolvedReference.getTargets().add(resolvedService);
+ } else {
+ warning("Incompatible interfaces on wire source and target: " + source.getName() + " : " + target.getName(), composite);
+ }
+ }
+ }
+
+ // Clear the list of wires
+ composite.getWires().clear();
+ }
+
+ /**
+ * Follow a service promotion chain down to the inner most (non composite)
+ * component service.
+ *
+ * @param topCompositeService
+ * @return
+ */
+ private ComponentService getPromotedComponentService(CompositeService compositeService) {
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ Service service = componentService.getService();
+ if (componentService.getName() != null && service instanceof CompositeService) {
+
+ // Continue to follow the service promotion chain
+ return getPromotedComponentService((CompositeService)service);
+
+ } else {
+
+ // Found a non-composite service
+ return componentService;
+ }
+ } else {
+
+ // No promoted service
+ return null;
+ }
+ }
+
+ /**
+ * Follow a reference promotion chain down to the inner most (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @return
+ */
+ private List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
+ List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
+ collectPromotedComponentReferences(compositeReference, componentReferences);
+ return componentReferences;
+ }
+
+ /**
+ * Follow a reference promotion chain down to the inner most (non composite)
+ * component references.
+ *
+ * @param compositeReference
+ * @param componentReferences
+ * @return
+ */
+ private void collectPromotedComponentReferences(CompositeReference compositeReference,
+ List<ComponentReference> componentReferences) {
+ for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
+ Reference reference = componentReference.getReference();
+ if (reference instanceof CompositeReference) {
+
+ // Continue to follow the reference promotion chain
+ collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
+
+ } else if (reference != null) {
+
+ // Found a non-composite reference
+ componentReferences.add(componentReference);
+ }
+ }
+ }
+
+ /**
+ * Activate composite services in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void activateCompositeServices(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ // First process nested composites
+ activateCompositeServices((Composite)implementation);
+
+ // Process the component services declared on components
+ // in this composite
+ for (ComponentService componentService : component.getServices()) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+
+ // Get the inner most promoted service
+ ComponentService promotedService = getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+
+ // Default to use the interface from the promoted service
+ if (compositeService.getInterfaceContract() == null) {
+ compositeService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+ if (componentService.getInterfaceContract() == null) {
+ componentService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+
+ // Create a new component service to represent this composite
+ // service on the promoted component
+ SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+ if (scaBinding != null) {
+ Component promotedComponent = scaBinding.getComponent();
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + compositeService.getName());
+ //newComponentService.setService(compositeService);
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.getBindings().add(scaBinding);
+ newComponentService.getBindings().addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
+ newComponentService.setCallback(compositeService.getCallback());
+
+ // FIXME: [rfeng] Set the service to promoted
+ newComponentService.setService(promotedService.getService());
+
+ // Change the composite service to now promote the newly
+ // created component service directly
+ compositeService.setPromotedService(newComponentService);
+
+ } else {
+ warning("Promoted component service not found: " + promotedService.getName(), composite);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Process composite services declared in this composite
+ for (Service service : composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+
+ // Get the inner most promoted service
+ ComponentService promotedService = getPromotedComponentService(compositeService);
+ if (promotedService != null) {
+
+ // Default to use the interface from the promoted service
+ if (compositeService.getInterfaceContract() == null && promotedService.getInterfaceContract() != null) {
+ compositeService.setInterfaceContract(promotedService.getInterfaceContract());
+ }
+
+ // Create a new component service to represent this composite
+ // service on the promoted component
+ SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+ if (scaBinding != null) {
+ Component promotedComponent = scaBinding.getComponent();
+ ComponentService newComponentService = assemblyFactory.createComponentService();
+ newComponentService.setName("$promoted$." + compositeService.getName());
+ //newComponentService.setService(compositeService);
+ promotedComponent.getServices().add(newComponentService);
+ newComponentService.getBindings().add(scaBinding);
+ newComponentService.getBindings().addAll(compositeService.getBindings());
+ newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
+ newComponentService.setCallback(compositeService.getCallback());
+
+ // FIXME: [rfeng] Set the service to promoted
+ newComponentService.setService(promotedService.getService());
+
+ // Change the composite service to now promote the newly
+ // created component service directly
+ compositeService.setPromotedService(newComponentService);
+ } else {
+ warning("Promoted component service not found: " + promotedService.getName(), composite);
+ }
+ }
+ }
+ }
+
+ /**
+ * Wire composite references in nested composites.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void wireCompositeReferences(Composite composite) {
+
+ // Process nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireCompositeReferences((Composite)implementation);
+ }
+ }
+
+ // Process composite references declared in this composite
+ for (Reference reference : composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+
+ // Override the configuration of the promoted reference
+ SCABinding scaBinding = promotedReference.getBinding(SCABinding.class);
+ promotedReference.getBindings().clear();
+ promotedReference.getBindings().add(scaBinding);
+ promotedReference.getBindings().addAll(compositeReference.getBindings());
+ }
+ }
+
+ // Process the component references declared on components
+ // in this composite
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ for (ComponentReference componentReference : component.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)componentReference.getReference();
+ if (compositeReference != null) {
+ List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
+ for (ComponentReference promotedReference : promotedReferences) {
+
+ // Override the configuration of the promoted
+ // reference
+ SCABinding scaBinding = promotedReference.getBinding(SCABinding.class);
+ promotedReference.getBindings().clear();
+ promotedReference.getBindings().add(scaBinding);
+ promotedReference.getBindings().addAll(componentReference.getBindings());
+
+ // Wire the promoted reference to the actual
+ // non-composite component services
+ promotedReference.getTargets().clear();
+ for (ComponentService target : componentReference.getTargets()) {
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ promotedReference.getTargets().add(componentService);
+ }
+ } else {
+
+ // Wire to a non-composite target service
+ promotedReference.getTargets().add(target);
+ }
+ }
+ }
+ }
+ }
+ } else {
+ for (ComponentReference componentReference : component.getReferences()) {
+
+ // Wire the component reference to the actual
+ // non-composite component services
+ List<ComponentService> targets = componentReference.getTargets();
+ for (int i = 0, n = targets.size(); i<n; i++) {
+ ComponentService target = targets.get(i);
+ if (target.getService() instanceof CompositeService) {
+
+ // Wire to the actual component service
+ // promoted by a composite service
+ CompositeService compositeService = (CompositeService)target.getService();
+ ComponentService componentService = compositeService.getPromotedService();
+ if (componentService != null) {
+ targets.set(i, componentService);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Wire component references to component services and connect promoted
+ * services/references to component services/references inside a composite.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void wireComposite(Composite composite) {
+
+ // Wire nested composites recursively
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ wireComposite((Composite)implementation);
+ }
+ }
+
+ // Index and bind all component services and references
+ Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
+ Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
+
+ // Create SCA bindings on all component services and references
+ createSCABindings(composite, componentServices, componentReferences);
+
+ // Connect composite services and references to the component
+ // services and references that they promote
+ connectCompositeServices(composite, componentServices);
+ connectCompositeReferences(composite, componentReferences);
+
+ // Connect component references to their targets
+ connectComponentReferences(composite, componentServices, componentReferences);
+
+ // Connect component references as described in wires
+ connectWires(composite, componentServices, componentReferences);
+
+ // Resolve sourced properties
+ resolveSourcedProperties(composite, null);
+
+ // Validate that references are wired or promoted, according
+ // to their multiplicity
+ for (ComponentReference componentReference : componentReferences.values()) {
+ if (!ReferenceUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference
+ .getTargets(), componentReference.getBindings())) {
+ if (componentReference.getTargets().isEmpty()) {
+
+ // No warning if the reference is promoted out of the current composite
+ boolean promoted = false;
+ for (Reference reference: composite.getReferences()) {
+ CompositeReference compositeReference = (CompositeReference)reference;
+ if (compositeReference.getPromotedReferences().contains(componentReference)) {
+ promoted = true;
+ break;
+ }
+ }
+ if (!promoted) {
+ warning("No targets for reference: " + componentReference.getName(), composite);
+ }
+ } else {
+ warning("Too many targets on reference: " + componentReference.getName(), composite);
+ }
+ }
+ }
+ }
+
+ private ComponentProperty getComponentPropertyByName(String propertyName, List<ComponentProperty> properties) {
+ if (properties != null) {
+ for (ComponentProperty aProperty : properties) {
+ if (aProperty.getName().equals(propertyName)) {
+ return aProperty;
+ }
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * @param composite
+ */
+ private void resolveSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
+ // Resolve properties
+ Map<String, Property> compositeProperties = new HashMap<String, Property>();
+ ComponentProperty componentProperty = null;
+ for (Property p : composite.getProperties()) {
+ componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
+ if ( componentProperty != null ) {
+ compositeProperties.put(p.getName(), componentProperty);
+ } else {
+ compositeProperties.put(p.getName(), p);
+ }
+ }
+
+ for (Component component : composite.getComponents()) {
+ try {
+ PropertyUtil.sourceComponentProperties(compositeProperties, component);
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Implementation impl = component.getImplementation();
+ if (impl instanceof Composite) {
+ resolveSourcedProperties((Composite)impl, component.getProperties());
+ }
+ }
+ }
+
+
+ /**
+ * Expand composite component implementations.
+ *
+ * @param composite
+ * @param problems
+ */
+ protected void expandComposites(Composite composite) {
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+
+ Composite compositeImplementation = (Composite)implementation;
+ Composite clone;
+ try {
+ clone = (Composite)compositeImplementation.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ component.setImplementation(clone);
+ expandComposites(clone);
+ }
+ }
+ }
+
+ /**
+ * For all the services, create a corresponding self-reference.
+ *
+ * @param component
+ */
+ private void createSelfReferences(Component component) {
+ for (ComponentService service : component.getServices()) {
+ ComponentReference componentReference = assemblyFactory.createComponentReference();
+ componentReference.setName("$self$." + service.getName());
+ componentReference.getBindings().addAll(service.getBindings());
+ ComponentService componentService = assemblyFactory.createComponentService();
+ componentService.setName(component.getName() + "/" + service.getName());
+ componentService.setUnresolved(true);
+ componentReference.getTargets().add(componentService);
+ componentReference.getPolicySets().addAll(service.getPolicySets());
+ componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
+ componentReference.setInterfaceContract(service.getInterfaceContract());
+ componentReference.setMultiplicity(Multiplicity.ONE_ONE);
+ component.getReferences().add(componentReference);
+ }
+ }
+
+ /**
+ * Report an error.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ @SuppressWarnings("unused")
+ private void error(String message, Object model) {
+ monitor.problem(new ProblemImpl(Severity.ERROR, message, model));
+ }
+
+ /**
+ * Report a warning.
+ *
+ * @param problems
+ * @param message
+ * @param model
+ */
+ private void warning(String message, Object model) {
+ monitor.problem(new ProblemImpl(Severity.WARNING, message, model));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.java
new file mode 100644
index 0000000000..2b85cec9fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ProblemImpl.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.assembly.builder.impl;
+
+import org.apache.tuscany.sca.assembly.builder.Problem;
+
+
+/**
+ * Reports a composite assembly problem.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProblemImpl implements Problem {
+
+ private String message;
+ private Severity severity;
+ private Object model;
+ private Object resource;
+ private Exception cause;
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param model
+ */
+ public ProblemImpl(Severity severity, String message, Object model) {
+ this.severity = severity;
+ this.message = message;
+ this.model = model;
+ }
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param model
+ * @param resource
+ */
+ public ProblemImpl(Severity severity, String message, Object model, Object resource) {
+ this.severity = severity;
+ this.message = message;
+ this.model = model;
+ this.resource = resource;
+ }
+
+ /**
+ * Constructs a new problem.
+ *
+ * @param severity
+ * @param message
+ * @param cause
+ */
+ public ProblemImpl(Severity severity, String message, Exception cause) {
+ this.severity = severity;
+ this.message = message;
+ this.cause = cause;
+ }
+
+ public Severity getSeverity() {
+ return severity;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public Object getModel() {
+ return model;
+ }
+
+ public Object getResource() {
+ return resource;
+ }
+
+ public Exception getCause() {
+ return cause;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
new file mode 100644
index 0000000000..71be058795
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyUtil.java
@@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.assembly.builder.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Utility class to deal with processing of component properties that are taking values from the parent
+ * composite's properties or an external file.
+ */
+public class PropertyUtil {
+ private static final XPathFactory XPATH_FACTORY = XPathFactory.newInstance();
+ private static final DocumentBuilderFactory DOC_BUILDER_FACTORY = DocumentBuilderFactory.newInstance();
+ private static final TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
+
+ static private Document evaluate(NamespaceContext nsContext, Node node, String xPathExpression)
+ throws XPathExpressionException, ParserConfigurationException {
+ XPath path = XPATH_FACTORY.newXPath();
+
+ if (nsContext != null) {
+ path.setNamespaceContext(nsContext);
+ } else {
+ path.setNamespaceContext(new DOMNamespaceContext(node));
+ }
+
+ XPathExpression expression = path.compile(xPathExpression);
+ Node result = (Node)expression.evaluate(node, XPathConstants.NODE);
+ if (result == null) {
+ return null;
+ }
+
+ // TODO: How to wrap the result into a Document?
+ Document document = DOC_BUILDER_FACTORY.newDocumentBuilder().newDocument();
+ if (result instanceof Document) {
+ return (Document)result;
+ } else {
+ //Element root = document.createElementNS(null, "value");
+ //document.appendChild(root);
+ document.appendChild(document.importNode(result, true));
+ return document;
+ }
+ }
+
+ static private Document loadFromFile(String file) throws MalformedURLException, IOException,
+ TransformerException, ParserConfigurationException {
+ URI uri = URI.create(file);
+ URL url = null;
+ if (!uri.isAbsolute()) {
+ url = Thread.currentThread().getContextClassLoader().getResource(file);
+ } else {
+ url = uri.toURL();
+ }
+ InputStream is = url.openStream();
+
+ Source streamSource = new SAXSource(new InputSource(is));
+ DOMResult result = new DOMResult();
+ javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
+ transformer.transform(streamSource, result);
+ is.close();
+
+ return (Document)result.getNode();
+ }
+
+ static void sourceComponentProperties(Map<String, Property> compositeProperties,
+ Component componentDefinition) throws CompositeBuilderException,
+ ParserConfigurationException,
+ XPathExpressionException,
+ TransformerException,
+ IOException {
+
+ List<ComponentProperty> componentProperties = componentDefinition.getProperties();
+ for (ComponentProperty aProperty : componentProperties) {
+ String source = aProperty.getSource();
+ String file = aProperty.getFile();
+ if (source != null) {
+ // $<name>/...
+ int index = source.indexOf('/');
+ if (index == -1) {
+ // Tolerating $prop
+ source = source + "/";
+ index = source.length() - 1;
+ }
+ if (source.charAt(0) == '$') {
+ String name = source.substring(1, index);
+ Property compositeProp = compositeProperties.get(name);
+ if (compositeProp == null) {
+ throw new CompositeBuilderException("The 'source' cannot be resolved to a composite property: " + source);
+ }
+
+ Document compositePropDefValues = (Document)compositeProp.getValue();
+
+ // Adding /value because the document root is "value"
+ String path = source.substring(index);
+ String xpath = null;
+
+ if ("/".equals(path)) {
+ // trailing / is not legal for xpath
+ xpath = "/value";
+ } else {
+ xpath = "/value" + path;
+ }
+
+ // FIXME: How to deal with namespaces?
+ Document node = evaluate(null, compositePropDefValues, xpath);
+
+ if (node != null) {
+ aProperty.setValue(node);
+ }
+ } else {
+ throw new CompositeBuilderException("The 'source' has an invalid value: " + source);
+ }
+ } else if (file != null) {
+ aProperty.setValue(loadFromFile(aProperty.getFile()));
+
+ }
+ }
+ }
+
+ private static class DOMNamespaceContext implements NamespaceContext {
+ private Node node;
+
+ /**
+ * @param node
+ */
+ public DOMNamespaceContext(Node node) {
+ super();
+ this.node = node;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return node.lookupNamespaceURI(prefix);
+ }
+
+ public String getPrefix(String namespaceURI) {
+ return node.lookupPrefix(namespaceURI);
+ }
+
+ public Iterator<?> getPrefixes(String namespaceURI) {
+ return null;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java
new file mode 100644
index 0000000000..9802e9ba63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceUtil.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.assembly.builder.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.SCABinding;
+
+/**
+ * This class encapsulates utility methods to deal with reference definitions
+ *
+ */
+class ReferenceUtil {
+ static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
+ if (definedMul != overridenMul) {
+ switch (definedMul) {
+ case ZERO_N:
+ return overridenMul == Multiplicity.ZERO_ONE;
+ case ONE_N:
+ return overridenMul == Multiplicity.ONE_ONE;
+ default:
+ return false;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ static boolean validateMultiplicityAndTargets(Multiplicity multiplicity,
+ List<?> targets, List<Binding> bindings) {
+
+ // Count targets
+ int count = targets.size();
+
+ //FIXME workaround, this validation is sometimes invoked too early
+ // before we get a chance to init the multiplicity attribute
+ if (multiplicity == null) {
+ return true;
+ }
+
+ switch (multiplicity) {
+ case ZERO_N:
+ break;
+ case ZERO_ONE:
+ if (count > 1) {
+ return false;
+ }
+ break;
+ case ONE_ONE:
+ if (count != 1) {
+ if (count == 0) {
+ for (Binding binding: bindings) {
+ if (!(binding instanceof SCABinding)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ case ONE_N:
+ if (count < 1) {
+ if (count == 0) {
+ for (Binding binding: bindings) {
+ if (!(binding instanceof SCABinding)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ break;
+ }
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
new file mode 100644
index 0000000000..989aea1237
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Represents an abstract property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyImpl extends BaseImpl implements AbstractProperty {
+ private Object value;
+ private String name;
+ private QName xsdType;
+ private QName xsdElement;
+ private boolean many;
+ private boolean mustSupply;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ /**
+ * Constructs a new abstract property.
+ */
+ protected AbstractPropertyImpl() {
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public QName getXSDElement() {
+ return xsdElement;
+ }
+
+ public QName getXSDType() {
+ return xsdType;
+ }
+
+ public boolean isMany() {
+ return many;
+ }
+
+ public boolean isMustSupply() {
+ return mustSupply;
+ }
+
+ public void setValue(Object defaultValue) {
+ this.value = defaultValue;
+ }
+
+ public void setMany(boolean many) {
+ this.many = many;
+ }
+
+ public void setMustSupply(boolean mustSupply) {
+ this.mustSupply = mustSupply;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setXSDElement(QName element) {
+ this.xsdElement = element;
+ }
+
+ public void setXSDType(QName type) {
+ this.xsdType = type;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
new file mode 100644
index 0000000000..d0ee3832c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+
+/**
+ * Represents an abstract reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractReferenceImpl extends ContractImpl implements AbstractReference {
+ private Multiplicity multiplicity = Multiplicity.ONE_ONE;
+
+ /**
+ * Constructs a new abstract reference.
+ */
+ protected AbstractReferenceImpl() {
+ }
+
+ public Multiplicity getMultiplicity() {
+ return multiplicity;
+ }
+
+ public void setMultiplicity(Multiplicity multiplicity) {
+ this.multiplicity = multiplicity;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
new file mode 100644
index 0000000000..346764b1b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractService;
+
+/**
+ * Represents an abstract service
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractServiceImpl extends ContractImpl implements AbstractService {
+
+ /**
+ * Constructs a new abstract service.
+ */
+ protected AbstractServiceImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
new file mode 100644
index 0000000000..1e623d35f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * A factory for the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AssemblyFactoryImpl implements AssemblyFactory {
+
+ public AbstractProperty createAbstractProperty() {
+ return new AbstractPropertyImpl();
+ }
+
+ public AbstractReference createAbstractReference() {
+ return new AbstractReferenceImpl();
+ }
+
+ public AbstractService createAbstractService() {
+ return new AbstractServiceImpl();
+ }
+
+ public Callback createCallback() {
+ return new CallbackImpl();
+ }
+
+ public Component createComponent() {
+ return new ComponentImpl();
+ }
+
+ public ComponentProperty createComponentProperty() {
+ return new ComponentPropertyImpl();
+ }
+
+ public ComponentReference createComponentReference() {
+ return new ComponentReferenceImpl();
+ }
+
+ public ComponentService createComponentService() {
+ return new ComponentServiceImpl();
+ }
+
+ public ComponentType createComponentType() {
+ return new ComponentTypeImpl();
+ }
+
+ public Composite createComposite() {
+ return new CompositeImpl();
+ }
+
+ public CompositeReference createCompositeReference() {
+ return new CompositeReferenceImpl();
+ }
+
+ public CompositeService createCompositeService() {
+ return new CompositeServiceImpl();
+ }
+
+ public ConstrainingType createConstrainingType() {
+ return new ConstrainingTypeImpl();
+ }
+
+ public Property createProperty() {
+ return new PropertyImpl();
+ }
+
+ public Reference createReference() {
+ return new ReferenceImpl();
+ }
+
+ public Service createService() {
+ return new ServiceImpl();
+ }
+
+ public Wire createWire() {
+ return new WireImpl();
+ }
+
+ public Operation createOperation() {
+ return new OperationImpl();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
new file mode 100644
index 0000000000..40c07d2e4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Visitable;
+import org.apache.tuscany.sca.assembly.Visitor;
+
+/**
+ * Convenience base class for assembly model objects.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseImpl implements Base, Visitable {
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
+
+ /**
+ * Constructs a new base model object.
+ */
+ protected BaseImpl() {
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public boolean accept(Visitor visitor) {
+ return visitor.visit(this);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
new file mode 100644
index 0000000000..87ef907a80
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackImpl extends BaseImpl implements Callback {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ protected CallbackImpl() {
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean accept(Visitor visitor) {
+ if (!super.accept(visitor)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
new file mode 100644
index 0000000000..ec837c060c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl extends BaseImpl implements Component, Cloneable {
+ private ConstrainingType constrainingType;
+ private Implementation implementation;
+ private String name;
+ private String uri;
+ private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
+ private List<ComponentReference> references = new ArrayList<ComponentReference>();
+ private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private boolean autowire;
+
+ /**
+ * Constructs a new component.
+ */
+ protected ComponentImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentImpl clone = (ComponentImpl)super.clone();
+
+ clone.properties = new ArrayList<ComponentProperty>();
+ for (ComponentProperty property: getProperties()) {
+ clone.properties.add((ComponentProperty)property.clone());
+ }
+ clone.references = new ArrayList<ComponentReference>();
+ for (ComponentReference reference: getReferences()) {
+ clone.references.add((ComponentReference)reference.clone());
+ }
+ clone.services = new ArrayList<ComponentService>();
+ for (ComponentService service: getServices()) {
+ clone.services.add((ComponentService)service.clone());
+ }
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public Implementation getImplementation() {
+ return implementation;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<ComponentProperty> getProperties() {
+ return properties;
+ }
+
+ public List<ComponentReference> getReferences() {
+ return references;
+ }
+
+ public List<ComponentService> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public void setImplementation(Implementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public boolean accept(Visitor visitor) {
+ if (!super.accept(visitor)) {
+ return false;
+ }
+ for (ComponentProperty property : properties) {
+ if (!visitor.visit(property)) {
+ return false;
+ }
+ }
+ for (ComponentReference reference : references) {
+ if (!visitor.visit(reference)) {
+ return false;
+ }
+ }
+ for (ComponentService service : services) {
+ if (!visitor.visit(service)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
new file mode 100644
index 0000000000..8a9b8e446d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.Property;
+
+/**
+ * Represents a component property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable {
+ private String file;
+ private Property property;
+ private String source;
+
+ /**
+ * Constructs a new component property.
+ */
+ protected ComponentPropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Object getValue() {
+ if (super.getValue() == null && property != null) {
+ return property.getValue();
+ } else {
+ return super.getValue();
+ }
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public Property getProperty() {
+ return property;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public void setProperty(Property property) {
+ this.property = property;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
new file mode 100644
index 0000000000..bd593f7502
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.Reference;
+
+/**
+ * Represents a component reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
+ private Reference reference;
+ private boolean autowire;
+ private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
+
+ /**
+ * Constructs a new component reference.
+ */
+ protected ComponentReferenceImpl() {
+ // Set multiplicity to null so that by default it'll inherit from the Reference
+ setMultiplicity(null);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Reference getReference() {
+ return reference;
+ }
+
+ public void setReference(Reference reference) {
+ this.reference = reference;
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public List<CompositeReference> promotedAs() {
+ return promotedAs;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
new file mode 100644
index 0000000000..66883133d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.Service;
+
+/**
+ * Represents a component service
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable {
+ private Service service;
+ private List<CompositeService> promotedAs = new ArrayList<CompositeService>();
+
+ /**
+ * Constructs a new component service.
+ */
+ protected ComponentServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public List<CompositeService> promotedAs() {
+ return promotedAs;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
new file mode 100644
index 0000000000..e57f25551a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a component type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeImpl extends BaseImpl implements ComponentType, Cloneable {
+ private String uri;
+ private ConstrainingType constrainingType;
+ private List<Property> properties = new ArrayList<Property>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Service> services = new ArrayList<Service>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new component type.
+ */
+ protected ComponentTypeImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ComponentTypeImpl clone = (ComponentTypeImpl)super.clone();
+
+ clone.services = new ArrayList<Service>();
+ for (Service service: getServices()) {
+ clone.services.add((Service)service.clone());
+ }
+ clone.references = new ArrayList<Reference>();
+ for (Reference reference: getReferences()) {
+ clone.references.add((Reference)reference.clone());
+ }
+ clone.properties = new ArrayList<Property>();
+ for (Property property: getProperties()) {
+ clone.properties.add((Property)property.clone());
+ }
+ return clone;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean accept(Visitor visitor) {
+ if (!super.accept(visitor)) {
+ return false;
+ }
+ for (Property property : properties) {
+ if (!visitor.visit(property)) {
+ return false;
+ }
+ }
+ for (Reference reference : references) {
+ if (!visitor.visit(reference)) {
+ return false;
+ }
+ }
+ for (Service service : services) {
+ if (!visitor.visit(service)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getURI()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ComponentType) {
+ if (getURI() != null) {
+ return getURI().equals(((ComponentType)obj).getURI());
+ } else {
+ return ((ComponentType)obj).getURI() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
new file mode 100644
index 0000000000..5c40f9445b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.assembly.Wire;
+
+public class CompositeImpl extends ComponentTypeImpl implements Composite, Cloneable {
+ private List<Component> components = new ArrayList<Component>();
+ private List<Composite> includes = new ArrayList<Composite>();
+ private QName name;
+ private List<Wire> wires = new ArrayList<Wire>();
+ private boolean autowire;
+ private boolean local = true;
+
+ /**
+ * Constructs a new composite.
+ */
+ protected CompositeImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ CompositeImpl clone = (CompositeImpl)super.clone();
+
+ clone.components = new ArrayList<Component>();
+ for (Component component: getComponents()) {
+ clone.components.add((Component)component.clone());
+ }
+ clone.wires = new ArrayList<Wire>();
+ for (Wire wire: getWires()) {
+ clone.wires.add((Wire)wire.clone());
+ }
+ return clone;
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public List<Composite> getIncludes() {
+ return includes;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public List<Wire> getWires() {
+ return wires;
+ }
+
+ public boolean isAutowire() {
+ return autowire;
+ }
+
+ public boolean isLocal() {
+ return local;
+ }
+
+ public void setAutowire(boolean autowire) {
+ this.autowire = autowire;
+ }
+
+ public void setLocal(boolean local) {
+ this.local = local;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean accept(Visitor visitor) {
+ boolean result = super.accept(visitor);
+ if (!result) {
+ return false;
+ }
+
+ for (Component component: components) {
+ if (!component.accept(visitor)) {
+ return false;
+ }
+ }
+
+ for (Wire wire: wires) {
+ if (!visitor.visit(wire))
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof Composite) {
+ if (getName() != null) {
+ return getName().equals(((Composite)obj).getName());
+ } else {
+ return ((Composite)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
new file mode 100644
index 0000000000..4348e08fcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+
+/**
+ * Represents a composite reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable {
+ private List<ComponentReference> promotedReferences = new ArrayList<ComponentReference>();
+
+ /**
+ * Constructs a new composite reference.
+ */
+ protected CompositeReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<ComponentReference> getPromotedReferences() {
+ return promotedReferences;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
new file mode 100644
index 0000000000..19a6ed56c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.CompositeService;
+
+/**
+ * Represents a composite service
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable {
+ private ComponentService promotedService;
+
+ /**
+ * Constructs a new composite service.
+ */
+ protected CompositeServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public ComponentService getPromotedService() {
+ return promotedService;
+ }
+
+ public void setPromotedService(ComponentService promotedService) {
+ this.promotedService = promotedService;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
new file mode 100644
index 0000000000..f9fbae6659
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.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.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Represents a constraining type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeImpl extends BaseImpl implements ConstrainingType {
+ private QName name;
+ private List<AbstractProperty> properties = new ArrayList<AbstractProperty>();
+ private List<AbstractReference> references = new ArrayList<AbstractReference>();
+ private List<AbstractService> services = new ArrayList<AbstractService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ /**
+ * Constructs a new ConstrainingType
+ */
+ protected ConstrainingTypeImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<AbstractProperty> getProperties() {
+ return properties;
+ }
+
+ public List<AbstractReference> getReferences() {
+ return references;
+ }
+
+ public List<AbstractService> getServices() {
+ return services;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean accept(Visitor visitor) {
+ if (!super.accept(visitor)) {
+ return false;
+ }
+ for (AbstractProperty property : properties) {
+ if (!visitor.visit(property)) {
+ return false;
+ }
+ }
+ for (AbstractReference reference : references) {
+ if (!visitor.visit(reference)) {
+ return false;
+ }
+ }
+ for (AbstractService service : services) {
+ if (!visitor.visit(service)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof ConstrainingType) {
+ if (getName() != null) {
+ return getName().equals(((ConstrainingType)obj).getName());
+ } else {
+ return ((ConstrainingType)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
new file mode 100644
index 0000000000..d295384305
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.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 org.apache.tuscany.sca.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AbstractContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+
+public class ContractImpl extends BaseImpl implements AbstractContract {
+ private InterfaceContract interfaceContract;
+ private String name;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+
+ /**
+ * Constructs a new contract.
+ */
+ protected ContractImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
new file mode 100644
index 0000000000..ebdcdf580b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a property.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable {
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new property.
+ */
+ protected PropertyImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
new file mode 100644
index 0000000000..5ceb5bb950
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private boolean wiredByImpl;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<ComponentService> targets = new ArrayList<ComponentService>();
+ private Callback callback;
+
+ /**
+ * Constructs a new reference.
+ */
+ protected ReferenceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ReferenceImpl clone = (ReferenceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ clone.bindings.addAll(getBindings());
+ clone.targets = new ArrayList<ComponentService>();
+ clone.targets.addAll(getTargets());
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public boolean isWiredByImpl() {
+ return wiredByImpl;
+ }
+
+ public void setWiredByImpl(boolean wiredByImpl) {
+ this.wiredByImpl = wiredByImpl;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<ComponentService> getTargets() {
+ return targets;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.java
new file mode 100644
index 0000000000..402b90706d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingFactoryImpl.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.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+
+/**
+ * A factory for the SCA binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SCABindingFactoryImpl implements SCABindingFactory {
+
+ public SCABinding createSCABinding() {
+ return new SCABindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.java
new file mode 100644
index 0000000000..93b7d7a88f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/SCABindingImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents an SCA binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCABindingImpl implements SCABinding {
+ private String name;
+ private String uri;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<Object> extensions = new ArrayList<Object>();
+
+ private Component component;
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected SCABindingImpl() {
+ }
+
+ public Component getComponent() {
+ return component;
+ }
+
+ public void setComponent(Component component) {
+ this.component = component;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
new file mode 100644
index 0000000000..c5bf3a10d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable {
+ private List<Binding> bindings = new ArrayList<Binding>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private Callback callback;
+
+ /**
+ * Constructs a new service.
+ */
+ protected ServiceImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ ServiceImpl clone = (ServiceImpl)super.clone();
+ clone.bindings = new ArrayList<Binding>();
+ clone.bindings.addAll(getBindings());
+ return clone;
+ }
+
+ public List<Binding> getBindings() {
+ return bindings;
+ }
+
+ public <B> B getBinding(Class<B> bindingClass) {
+ for (Binding binding : bindings) {
+ if (bindingClass.isInstance(binding)) {
+ return bindingClass.cast(binding);
+ }
+ }
+ return null;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public Callback getCallback() {
+ return callback;
+ }
+
+ public void setCallback(Callback callback) {
+ this.callback = callback;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
new file mode 100644
index 0000000000..06db488fba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.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.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireImpl extends BaseImpl implements Wire, Cloneable {
+ private ComponentReference source;
+ private ComponentService target;
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+
+ /**
+ * Constructs a new wire.
+ */
+ protected WireImpl() {
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public ComponentReference getSource() {
+ return source;
+ }
+
+ public ComponentService getTarget() {
+ return target;
+ }
+
+ public void setSource(ComponentReference source) {
+ this.source = source;
+ }
+
+ public void setTarget(ComponentService target) {
+ this.target = target;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/util/PrintUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/util/PrintUtil.java
new file mode 100644
index 0000000000..08b39f976b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/util/PrintUtil.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly.util;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.w3c.dom.Node;
+
+/**
+ * A simple print utility class to help print model instances.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrintUtil {
+
+ private PrintWriter out;
+ private int indent;
+
+ public PrintUtil(OutputStream out) {
+ this.out = new PrintWriter(new OutputStreamWriter(out), true);
+ }
+
+ void indent() {
+ for (int i = 0; i < indent; i++) {
+ out.print(" ");
+ }
+ }
+
+ /**
+ * Print an object.
+ *
+ * @param object
+ */
+ public void print(Object object) {
+ Set<Integer> objects = new HashSet<Integer>();
+ print(object, objects);
+ }
+
+ /**
+ * Print an object.
+ *
+ * @param object
+ */
+ private void print(Object object, Set<Integer> printed) {
+ if (object == null) {
+ return;
+ }
+ int id = System.identityHashCode(object);
+ if (printed.contains(id)) {
+
+ // If we've already printed an object, print just it's hashcode
+ indent();
+ out.println(object.getClass().getName() + "@" + id);
+ } else {
+ printed.add(id);
+ try {
+
+ // Print the object class name
+ indent();
+ out.println(object.getClass().getSimpleName() + " {");
+
+ // Get the object's properties
+ BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
+ for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
+ try {
+
+ // Get the value of each property
+ Method getter = propertyDescriptor.getReadMethod();
+ if (getter == null) {
+ continue;
+ }
+ Object value = getter.invoke(object);
+ if (value != null) {
+
+ // Convert array value into a list
+ if (value.getClass().isArray()) {
+ value = Arrays.asList((Object[])value);
+ }
+
+ // Print elements in a list
+ if (value instanceof List) {
+ if (!((List)value).isEmpty()) {
+ indent++;
+ indent();
+ out.println(propertyDescriptor.getName() + "= [");
+
+ // Print each element, recursively
+ for (Object element : (List)value) {
+ indent++;
+ print(element, printed);
+ indent--;
+ }
+ indent();
+ out.println(" ]");
+ indent--;
+ }
+ } else {
+ Class<?> valueClass = value.getClass();
+
+ // Print a primitive, java built in type or
+ // enum, using toString()
+ if (valueClass.isPrimitive() || valueClass.getName().startsWith("java.")
+ || valueClass.getName().startsWith("javax.")
+ || valueClass.isEnum()) {
+ if (!propertyDescriptor.getName().equals("class")) {
+ if (!(Boolean.FALSE.equals(value))) {
+ indent++;
+ indent();
+ out.println(propertyDescriptor.getName() + "=" + value.toString());
+ indent--;
+ }
+ }
+ } else if (value instanceof Node) {
+ indent++;
+ indent();
+ out.println(propertyDescriptor.getName() + "=" + value.toString());
+ indent--;
+ } else {
+
+ // Print an object, recursively
+ indent++;
+ indent();
+ out.println(propertyDescriptor.getName() + "= {");
+ indent++;
+ print(value, printed);
+ indent--;
+ indent();
+ out.println("}");
+ indent--;
+ }
+ }
+ }
+ } catch (Exception e) {
+ }
+ }
+ indent();
+ out.println("}");
+ } catch (IntrospectionException e) {
+ indent();
+ out.println(e);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
new file mode 100644
index 0000000000..cde42cbc62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
@@ -0,0 +1,212 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.assembly;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test building of assembly model instances using the assembly factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AssemblyFactoryTestCase extends TestCase {
+
+ AssemblyFactory factory;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ }
+
+ public void testCreateComponent() {
+ createComponent("AccountServiceComponent1");
+ }
+
+ public void testCreateComponentType() {
+ createComponentType();
+ }
+
+ public void testCreateComposite() {
+ createComposite();
+ }
+
+ public void testCreateConstrainingType() {
+ createConstrainingType();
+ }
+
+ /**
+ * Create a composite
+ */
+ Composite createComposite() {
+ Composite c = factory.createComposite();
+
+ Component c1 = createComponent("AccountServiceComponent1");
+ c.getComponents().add(c1);
+ Component c2 = createComponent("AccountServiceComponent2");
+ c.getComponents().add(c2);
+
+ Wire w = factory.createWire();
+ w.setSource(c1.getReferences().get(0));
+ w.setTarget(c2.getServices().get(0));
+ c.getWires().add(w);
+
+ CompositeService cs = factory.createCompositeService();
+ cs.setName("AccountService");
+ cs.setPromotedService(c1.getServices().get(0));
+ cs.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getServices().add(cs);
+ cs.getBindings().add(new TestBinding(factory));
+
+ CompositeReference cr = factory.createCompositeReference();
+ cr.setName("StockQuoteService");
+ cr.getPromotedReferences().add(c2.getReferences().get(1));
+ cr.setInterfaceContract(new TestInterfaceContract(factory));
+ c.getReferences().add(cr);
+ cr.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component
+ */
+ Component createComponent(String name) {
+ Component c = factory.createComponent();
+ c.setName(name);
+
+ ConstrainingType constraint = createConstrainingType();
+ c.setConstrainingType(constraint);
+
+ Implementation i = new TestImplementation(factory);
+ c.setImplementation(i);
+
+ ComponentProperty p = factory.createComponentProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ p.setProperty(i.getProperties().get(0));
+ c.getProperties().add(p);
+
+ ComponentReference ref1 = factory.createComponentReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setReference(i.getReferences().get(0));
+ c.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ ComponentReference ref2 = factory.createComponentReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setReference(i.getReferences().get(1));
+ c.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ ComponentService s = factory.createComponentService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ s.setService(i.getServices().get(0));
+ c.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return c;
+ }
+
+ /**
+ * Create a new component type
+ *
+ * @return
+ */
+ ComponentType createComponentType() {
+ ComponentType ctype = factory.createComponentType();
+
+ Property p = factory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ Reference ref1 = factory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ Reference ref2 = factory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ Service s = factory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ return ctype;
+ }
+
+ /**
+ * Create a new constraining type
+ *
+ * @return
+ */
+ ConstrainingType createConstrainingType() {
+ ConstrainingType ctype = factory.createConstrainingType();
+
+ AbstractProperty p = factory.createAbstractProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ ctype.getProperties().add(p);
+
+ AbstractReference ref1 = factory.createAbstractReference();
+ ref1.setName("accountDataService");
+ ref1.setInterfaceContract(new TestInterfaceContract(factory));
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref1);
+
+ AbstractReference ref2 = factory.createAbstractReference();
+ ref2.setName("stockQuoteService");
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ctype.getReferences().add(ref2);
+
+ AbstractService s = factory.createAbstractService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ ctype.getServices().add(s);
+
+ return ctype;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
new file mode 100644
index 0000000000..9b3ac4c2d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.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.assembly;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * A test interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestBinding implements Binding {
+
+ public TestBinding(AssemblyFactory factory) {
+ setURI("http://test");
+ }
+
+ public String getName() {
+ return null;
+ }
+
+ public String getURI() {
+ return "http://test";
+ }
+
+ public void setName(String name) {
+ }
+
+ public void setURI(String uri) {
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return null;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return null;
+ }
+
+ public List<Object> getExtensions() {
+ return null;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
new file mode 100644
index 0000000000..9e34fafb05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.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.assembly;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.ComponentTypeImpl;
+
+/**
+ * A test component implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementation extends ComponentTypeImpl implements Implementation {
+
+ public TestImplementation(AssemblyFactory factory) {
+
+ Property p = factory.createProperty();
+ p.setName("currency");
+ p.setValue("USD");
+ p.setMustSupply(true);
+ p.setXSDType(new QName("", ""));
+ getProperties().add(p);
+
+ Reference ref1 = factory.createReference();
+ ref1.setName("accountDataService");
+ ref1.setMultiplicity(Multiplicity.ONE_ONE);
+ getReferences().add(ref1);
+ ref1.getBindings().add(new TestBinding(factory));
+
+ Reference ref2 = factory.createReference();
+ ref2.setName("stockQuoteService");
+ ref2.setMultiplicity(Multiplicity.ONE_ONE);
+ ref2.setInterfaceContract(new TestInterfaceContract(factory));
+ getReferences().add(ref2);
+ ref2.getBindings().add(new TestBinding(factory));
+
+ Service s = factory.createService();
+ s.setName("AccountService");
+ s.setInterfaceContract(new TestInterfaceContract(factory));
+ getServices().add(s);
+ s.getBindings().add(new TestBinding(factory));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java
new file mode 100644
index 0000000000..dbe0cb8225
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.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.sca.assembly;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+
+/**
+ * A test interface model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInterface extends InterfaceImpl implements Interface {
+
+ public TestInterface(AssemblyFactory factory) {
+
+ setRemotable(true);
+
+ Operation operation = new TestOperation();
+ operation.setName("test");
+ getOperations().add(operation);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java
new file mode 100644
index 0000000000..ee6b95edc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.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.sca.assembly;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+
+/**
+ * A test interface contract model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
+
+ public TestInterfaceContract(AssemblyFactory factory) {
+
+ TestInterface testInterface = new TestInterface(factory);
+ setInterface(testInterface);
+
+ TestInterface testCallbackInterface = new TestInterface(factory);
+ setCallbackInterface(testCallbackInterface);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
new file mode 100644
index 0000000000..460672c1ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.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.assembly;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * A test operation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestOperation extends OperationImpl implements Operation {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
new file mode 100644
index 0000000000..aeb076a392
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.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.sca.assembly.builder.impl;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+
+public class CompositeBuilderTestCase extends TestCase {
+
+ private CompositeBuilderImpl compositeUtil;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+
+ protected void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+
+ compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new InterfaceContractMapperImpl(), null);
+ }
+
+ protected void tearDown() throws Exception {
+ compositeUtil = null;
+ assemblyFactory = null;
+ }
+
+ public void testFuseIncludes() {
+ Composite c1 = assemblyFactory.createComposite();
+ c1.setName(new QName("http://foo", "C1"));
+ Component a = assemblyFactory.createComponent();
+ a.setName("a");
+ c1.getComponents().add(a);
+ CompositeService s = assemblyFactory.createCompositeService();
+ s.setName("s");
+ c1.getServices().add(s);
+ CompositeReference r = assemblyFactory.createCompositeReference();
+ r.setName("r");
+ c1.getReferences().add(r);
+
+ Composite c2 = assemblyFactory.createComposite();
+ c2.setName(new QName("http://foo", "C2"));
+ c1.getIncludes().add(c2);
+ Component b = assemblyFactory.createComponent();
+ b.setName("b");
+ c2.getComponents().add(b);
+
+ Composite c = assemblyFactory.createComposite();
+ c.setName(new QName("http://foo", "C"));
+ c.getIncludes().add(c1);
+
+ compositeUtil.fuseIncludes(c);
+
+ assertTrue(c.getComponents().get(0).getName().equals("a"));
+ assertTrue(c.getComponents().get(1).getName().equals("b"));
+ assertTrue(c.getServices().get(0).getName().equals("s"));
+ assertTrue(c.getReferences().get(0).getName().equals("r"));
+ }
+
+ public void testExpandComposites() {
+ Composite c1 = assemblyFactory.createComposite();
+ c1.setName(new QName("http://foo", "C1"));
+ Component a = assemblyFactory.createComponent();
+ a.setName("a");
+ c1.getComponents().add(a);
+ CompositeService s = assemblyFactory.createCompositeService();
+ s.setName("s");
+ c1.getServices().add(s);
+ CompositeReference r = assemblyFactory.createCompositeReference();
+ r.setName("r");
+ c1.getReferences().add(r);
+
+ Composite c2 = assemblyFactory.createComposite();
+ c2.setName(new QName("http://foo", "C2"));
+ Component b = assemblyFactory.createComponent();
+ b.setName("b");
+ c2.getComponents().add(b);
+
+ Composite c = assemblyFactory.createComposite();
+ c.setName(new QName("http://foo", "C"));
+ Component x = assemblyFactory.createComponent();
+ x.setName("x");
+ x.setImplementation(c1);
+ c.getComponents().add(x);
+ Component y = assemblyFactory.createComponent();
+ y.setName("y");
+ y.setImplementation(c2);
+ c.getComponents().add(y);
+ Component z = assemblyFactory.createComponent();
+ z.setName("z");
+ z.setImplementation(c1);
+ c.getComponents().add(z);
+
+ compositeUtil.expandComposites(c);
+
+ assertTrue(c.getComponents().get(0).getImplementation() != c1);
+ assertTrue(c.getComponents().get(1).getImplementation() != c2);
+ assertTrue(c.getComponents().get(2).getImplementation() != c1);
+
+ Composite i = (Composite)c.getComponents().get(0).getImplementation();
+ assertTrue(i.getComponents().get(0) != a);
+ assertTrue(i.getComponents().get(0).getName().equals("a"));
+ assertTrue(i.getServices().get(0).getName().equals("s"));
+ assertTrue(i.getServices().get(0) != s);
+ assertTrue(i.getReferences().get(0).getName().equals("r"));
+ assertTrue(i.getReferences().get(0) != r);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/pom.xml
new file mode 100644
index 0000000000..d5493a95de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/pom.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <name>Apache Tuscany JSON-RPC Binding</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.metaparadigm</groupId>
+ <artifactId>json-rpc</artifactId>
+ <version>1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.json-lib</groupId>
+ <artifactId>json-lib</artifactId>
+ <version>0.8</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>httpunit</groupId>
+ <artifactId>httpunit</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/DefaultJSONRPCBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/DefaultJSONRPCBindingFactory.java
new file mode 100644
index 0000000000..31575518f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/DefaultJSONRPCBindingFactory.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.binding.jsonrpc;
+
+import org.apache.tuscany.sca.binding.jsonrpc.impl.JSONRPCBindingImpl;
+
+/**
+ * A factory for the JSONRPC binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJSONRPCBindingFactory implements JSONRPCBindingFactory {
+
+ public JSONRPCBinding createJSONRPCBinding() {
+ return new JSONRPCBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
new file mode 100644
index 0000000000..5e0e3b5b28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.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.binding.jsonrpc;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the sample JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JSONRPCBinding extends Binding {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java
new file mode 100644
index 0000000000..7ba422eb85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.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.binding.jsonrpc;
+
+/**
+ * A factory for the JSONRPC binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JSONRPCBindingFactory {
+
+ /**
+ * Creates a new JSONRPC binding.
+ *
+ * @return a new JSONRPC binding
+ */
+ JSONRPCBinding createJSONRPCBinding();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java
new file mode 100644
index 0000000000..66f6dd640d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.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.binding.jsonrpc.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * Implementation of the JSONRPC binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingImpl implements JSONRPCBinding {
+
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample binding does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingProcessor.java
new file mode 100644
index 0000000000..1ff888ace6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingProcessor.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.binding.jsonrpc.impl;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory;
+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;
+
+
+/**
+ * A processor for <binding.jsonrpc> elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingProcessor implements StAXArtifactProcessor<JSONRPCBinding> {
+
+ private QName BINDING_JSONRPC = new QName(SCA_NS, "binding.jsonrpc");
+
+ private final JSONRPCBindingFactory factory;
+
+ public JSONRPCBindingProcessor(JSONRPCBindingFactory factory) {
+ this.factory = factory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_JSONRPC;
+ }
+
+ public Class<JSONRPCBinding> getModelType() {
+ return JSONRPCBinding.class;
+ }
+
+ public JSONRPCBinding read(XMLStreamReader reader) throws ContributionReadException {
+ String uri = reader.getAttributeValue(null, "uri");
+ JSONRPCBinding JSONRPCBinding = factory.createJSONRPCBinding();
+ if (uri != null) {
+ JSONRPCBinding.setURI(uri.trim());
+ }
+ return JSONRPCBinding;
+ }
+
+ public void write(JSONRPCBinding JSONRPCBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ }
+
+ public void resolve(JSONRPCBinding JSONRPCBinding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/module/JSONRPCModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/module/JSONRPCModuleActivator.java
new file mode 100644
index 0000000000..3475a31923
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/module/JSONRPCModuleActivator.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.binding.jsonrpc.module;
+
+import org.apache.tuscany.sca.binding.jsonrpc.DefaultJSONRPCBindingFactory;
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory;
+import org.apache.tuscany.sca.binding.jsonrpc.impl.JSONRPCBindingProcessor;
+import org.apache.tuscany.sca.binding.jsonrpc.provider.JSONRPCBindingProviderFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+/**
+ * A module activator for the JSONRPC binding extension.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // No extensionPoints being contributed here
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the JSONRPC model factory
+ JSONRPCBindingFactory JSONRPCFactory = new DefaultJSONRPCBindingFactory();
+
+ // Add the JSONRPCProcessor extension
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ JSONRPCBindingProcessor JSONRPCBindingProcessor = new JSONRPCBindingProcessor(JSONRPCFactory);
+ processors.addArtifactProcessor(JSONRPCBindingProcessor);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ ServletHost servletHost = registry.getExtensionPoint(ServletHost.class);
+ providerFactories.addProviderFactory(new JSONRPCBindingProviderFactory(servletHost));
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
new file mode 100644
index 0000000000..ade2603516
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.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.binding.jsonrpc.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Interceptor for the sample JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingInvoker implements Invoker {
+
+ private Object echo(Object[] args) throws InvocationTargetException {
+ // echo back the result, a real binding would invoke some API for flowing the request
+ return args[0];
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = echo((Object[])msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
new file mode 100644
index 0000000000..4bbf39e02c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.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.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+
+/**
+ * Implementation of the JSONRPC binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSONRPCBinding> {
+
+ ServletHost servletHost;
+
+ public JSONRPCBindingProviderFactory(ServletHost servletHost) {
+ this.servletHost = servletHost;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JSONRPCBinding binding) {
+ return new JSONRPCReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JSONRPCBinding binding) {
+ return new JSONRPCServiceBindingProvider(component, service, binding, servletHost);
+ }
+
+ public Class<JSONRPCBinding> getModelType() {
+ return JSONRPCBinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
new file mode 100644
index 0000000000..c8e43d824a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.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.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+
+/**
+ * Implementation of the JSONRPC binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public JSONRPCReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ JSONRPCBinding binding) {
+ this.reference = reference;
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ if (isCallback) {
+ throw new UnsupportedOperationException();
+ } else {
+ return new JSONRPCBindingInvoker();
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
new file mode 100644
index 0000000000..be593baa97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.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.binding.jsonrpc.provider;
+
+import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
+import org.apache.tuscany.sca.binding.jsonrpc.server.JSONRPCEntryPointServlet;
+import org.apache.tuscany.sca.binding.jsonrpc.server.JSONRPCScriptServlet;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Implementation of the JSONRPC binding provider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
+
+ private static int servletRegistrationCount = 0;
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private JSONRPCBinding binding;
+ private ServletHost servletHost;
+
+ // path to the JSONRPC javascript servlet
+ public static final String SCRIPT_GETTER_SERVICE_MAPPING = "/SCA/scripts";
+
+ public static final String JSONRPC_SERVICE_MAPPING_PREFIX = "/";
+
+ public JSONRPCServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ JSONRPCBinding binding,
+ ServletHost servletHost) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.servletHost = servletHost;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public void start() {
+ JSONRPCEntryPointServlet servlet;
+
+ Class<?> aClass = getTargetJavaClass(service.getInterfaceContract().getInterface());
+ Object instance = component.createSelfReference(aClass).getService();
+
+ servlet = new JSONRPCEntryPointServlet(binding.getName(), aClass, instance);
+
+ // register the servlet based on the service name
+ servletHost.addServletMapping(JSONRPC_SERVICE_MAPPING_PREFIX + binding.getName(), servlet);
+
+ // if the script getter servlet is not already registered then register
+ // it
+ if (servletRegistrationCount == 0) {
+ servletHost.addServletMapping(SCRIPT_GETTER_SERVICE_MAPPING, new JSONRPCScriptServlet());
+ }
+
+ // increase the registered servlet count
+ servletRegistrationCount++;
+ }
+
+ public void stop() {
+
+ // Unregister from the servlet mapping
+ servletHost.removeServletMapping(JSONRPC_SERVICE_MAPPING_PREFIX + binding.getName());
+ servletRegistrationCount--;
+ // if we unregistered the last JSONRPC servlet, then unreister the
+ // script servlet
+ if (servletRegistrationCount == 0) {
+ servletHost.removeServletMapping(SCRIPT_GETTER_SERVICE_MAPPING);
+ }
+ }
+
+ private Class<?> getTargetJavaClass(Interface targetInterface) {
+ // TODO: right now assume that the target is always a Java
+ // Implementation. Need to figure out
+ // how to generate Java Interface in cases where the target is not a
+ // Java Implementation
+ return ((JavaInterface)targetInterface).getJavaClass();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCEntryPointServlet.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCEntryPointServlet.java
new file mode 100644
index 0000000000..cab8965f90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCEntryPointServlet.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.binding.jsonrpc.server;
+
+import java.io.BufferedReader;
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.text.ParseException;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.tuscany.sca.binding.jsonrpc.util.JavaToSmd;
+import org.json.JSONObject;
+
+import com.metaparadigm.jsonrpc.JSONRPCBridge;
+import com.metaparadigm.jsonrpc.JSONRPCResult;
+import com.metaparadigm.jsonrpc.JSONRPCServlet;
+
+/**
+ *
+ *
+ */
+public class JSONRPCEntryPointServlet extends JSONRPCServlet {
+ private static final long serialVersionUID = 1L;
+
+ private static final int BUF_SIZE = 4096;
+
+ String serviceName;
+
+ Object serviceInstance;
+
+ Class<?> serviceInterface;
+
+ // default constructor for unit testing
+ public JSONRPCEntryPointServlet() {
+ }
+
+ public JSONRPCEntryPointServlet(String serviceName, Class<?> serviceInterface, Object serviceInstance) {
+ this.serviceName = serviceName;
+ this.serviceInterface = serviceInterface;
+ this.serviceInstance = serviceInstance;
+ }
+
+ /**
+ * Override to do nothing as the JSONRPCServlet is setup by the
+ * service method in this class.
+ */
+ @Override
+ public void init(ServletConfig config) {
+ }
+
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ClassCastException {
+
+ // if there is a smd parameter, we should retrun the SMD for this service
+ if (request.getParameter("smd") != null) {
+ String serviceUrl = request.getRequestURL().toString();
+ String smd = JavaToSmd.interfaceToSmd(serviceInterface, serviceUrl);
+
+ response.setContentType("text/plain;charset=utf-8");
+ OutputStream out = response.getOutputStream();
+ byte[] bout = smd.getBytes("UTF-8");
+
+ out.write(bout);
+ out.flush();
+ out.close();
+ } else {
+ /*
+ * Create a new bridge for every request to aviod all the problems with
+ * JSON-RPC-Java storing the bridge in the session
+ */
+ HttpSession session = request.getSession();
+
+ JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
+ jsonrpcBridge.registerObject(serviceName, serviceInstance, serviceInterface);
+ session.setAttribute("JSONRPCBridge", jsonrpcBridge);
+
+ // Encode using UTF-8, although We are actually ASCII clean as
+ // all unicode data is JSON escaped using backslash u. This is
+ // less data efficient for foreign character sets but it is
+ // needed to support naughty browsers such as Konqueror and Safari
+ // which do not honour the charset set in the response
+ response.setContentType("text/plain;charset=utf-8");
+ OutputStream out = response.getOutputStream();
+
+ // Decode using the charset in the request if it exists otherwise
+ // use UTF-8 as this is what all browser implementations use.
+ // The JSON-RPC-Java JavaScript client is ASCII clean so it
+ // although here we can correctly handle data from other clients
+ // that do not escape non ASCII data
+ String charset = request.getCharacterEncoding();
+ if (charset == null) {
+ charset = "UTF-8";
+ }
+ BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), charset));
+
+ // Read the request
+ CharArrayWriter data = new CharArrayWriter();
+ char buf[] = new char[BUF_SIZE];
+ int ret;
+ while ((ret = in.read(buf, 0, BUF_SIZE)) != -1) {
+ data.write(buf, 0, ret);
+ }
+
+ // Process the request
+ JSONObject jsonReq = null;
+ JSONRPCResult jsonResp = null;
+ try {
+ jsonReq = new JSONObject(data.toString());
+ String method = jsonReq.getString("method");
+ if ((method != null) && (method.indexOf('.') < 0)) {
+ jsonReq.putOpt("method", serviceName + "." + method);
+ }
+ jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq);
+ } catch (ParseException e) {
+ throw new RuntimeException("Unable to parse request", e);
+ }
+
+ byte[] bout = jsonResp.toString().getBytes("UTF-8");
+
+ out.write(bout);
+ out.flush();
+ out.close();
+
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCScriptServlet.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCScriptServlet.java
new file mode 100644
index 0000000000..0fff49100e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/server/JSONRPCScriptServlet.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.binding.jsonrpc.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+public class JSONRPCScriptServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ // private static final String SCA_INIT_JS = "SCA = new JSONRpcClient(\"serviceBindings/HelloWorldService\");";
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ URL url = getClass().getResource("jsonrpc.js");
+ InputStream is = url.openStream();
+ writeToStream(response, is);
+
+ // writeToStream(response, new ByteArrayInputStream(SCA_INIT_JS.getBytes()));
+ }
+
+ private void writeToStream(HttpServletResponse response, InputStream is) throws IOException {
+ ServletOutputStream os = response.getOutputStream();
+ int i;
+ while ((i = is.read()) != -1) { // NOPMD
+ os.write(i);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/util/JavaToSmd.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/util/JavaToSmd.java
new file mode 100644
index 0000000000..339aca376c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/util/JavaToSmd.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.binding.jsonrpc.util;
+
+import java.lang.reflect.Method;
+
+
+public class JavaToSmd {
+
+ public static String interfaceToSmd(Class klazz, String serviceUrl) {
+ String name = klazz.getSimpleName();
+ Method methods[] = klazz.getMethods();
+
+ StringBuffer smdSb = new StringBuffer();
+ smdSb.append("{\"SMDVersion\":\".1\",\"objectName\":\"" + name + "\",\"serviceType\":\"JSON-RPC\",\"serviceURL\":\""+ serviceUrl + "\",\"methods\":[");
+ for (int i = 0; i < methods.length; i++) {
+ if (i != 0) smdSb.append(",");
+ Class<?> params[] = methods[i].getParameterTypes();
+ smdSb.append("{\"name\":\""+methods[i].getName() + "\",\"parameters\":[");
+ for (int j = 0; j < params.length; j++) {
+ if (j != 0) smdSb.append(",");
+ // right now Dojo doesn't look at the type value, so we'll default it to STRING
+ // also, since we can't introspect the method paramater names we'll just create an incrementing parameter name
+ smdSb.append("{\"name\":\"param" + j + "\",\"type\":\"STRING\"}");
+ }
+ smdSb.append("]}");
+ }
+ smdSb.append("]}");
+
+ return smdSb.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/JSONRPCBinding.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/JSONRPCBinding.composite
new file mode 100644
index 0000000000..38a596ecf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/JSONRPCBinding.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"
+ targetNamespace="http://jsonrpc"
+ xmlns:jsonrpc="http://jsonrpc"
+ name="JSONRPCBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="org.apache.tuscany.sca.binding.jsonrpc.Echo"/>
+ <binding.jsonrpc />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.jsonrpc.EchoComponentImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..c4fa1f5de1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.jsonrpc.module.JSONRPCModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/server/jsonrpc.js b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/server/jsonrpc.js
new file mode 100644
index 0000000000..2b9efbb55c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/server/jsonrpc.js
@@ -0,0 +1,484 @@
+/*
+ * JSON-RPC JavaScript client
+ *
+ * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $
+ *
+ * Copyright (c) 2003-2004 Jan-Klaas Kollhof
+ * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
+ *
+ * This code is based on Jan-Klaas' JavaScript o lait library (jsolait).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+/* escape a character */
+
+escapeJSONChar =
+function escapeJSONChar(c)
+{
+ if(c == "\"" || c == "\\") return "\\" + c;
+ else if (c == "\b") return "\\b";
+ else if (c == "\f") return "\\f";
+ else if (c == "\n") return "\\n";
+ else if (c == "\r") return "\\r";
+ else if (c == "\t") return "\\t";
+ var hex = c.charCodeAt(0).toString(16);
+ if(hex.length == 1) return "\\u000" + hex;
+ else if(hex.length == 2) return "\\u00" + hex;
+ else if(hex.length == 3) return "\\u0" + hex;
+ else return "\\u" + hex;
+};
+
+
+/* encode a string into JSON format */
+
+escapeJSONString =
+function escapeJSONString(s)
+{
+ /* The following should suffice but Safari's regex is b0rken
+ (doesn't support callback substitutions)
+ return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g,
+ escapeJSONChar) + "\"";
+ */
+
+ /* Rather inefficient way to do it */
+ var parts = s.split("");
+ for(var i=0; i < parts.length; i++) {
+ var c =parts[i];
+ if(c == '"' ||
+ c == '\\' ||
+ c.charCodeAt(0) < 32 ||
+ c.charCodeAt(0) >= 128)
+ parts[i] = escapeJSONChar(parts[i]);
+ }
+ return "\"" + parts.join("") + "\"";
+};
+
+
+/* Marshall objects to JSON format */
+
+toJSON = function toJSON(o)
+{
+ if(o == null) {
+ return "null";
+ } else if(o.constructor == String) {
+ return escapeJSONString(o);
+ } else if(o.constructor == Number) {
+ return o.toString();
+ } else if(o.constructor == Boolean) {
+ return o.toString();
+ } else if(o.constructor == Date) {
+ return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}';
+ } else if(o.constructor == Array) {
+ var v = [];
+ for(var i = 0; i < o.length; i++) v.push(toJSON(o[i]));
+ return "[" + v.join(", ") + "]";
+ } else {
+ var v = [];
+ for(attr in o) {
+ if(o[attr] == null) v.push("\"" + attr + "\": null");
+ else if(typeof o[attr] == "function"); /* skip */
+ else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
+ }
+ return "{" + v.join(", ") + "}";
+ }
+};
+
+
+/* JSONRpcClient constructor */
+
+JSONRpcClient =
+function JSONRpcClient_ctor(serverURL, user, pass, objectID)
+{
+ this.serverURL = serverURL;
+ this.user = user;
+ this.pass = pass;
+ this.objectID = objectID;
+
+ /* Add standard methods */
+ if(this.objectID) {
+ this._addMethods(["listMethods"]);
+ var req = this._makeRequest("listMethods", []);
+ } else {
+ this._addMethods(["system.listMethods"]);
+ var req = this._makeRequest("system.listMethods", []);
+ }
+ var m = this._sendRequest(req);
+ this._addMethods(m);
+};
+
+
+/* JSONRpcCLient.Exception */
+
+JSONRpcClient.Exception =
+function JSONRpcClient_Exception_ctor(code, message, javaStack)
+{
+ this.code = code;
+ var name;
+ if(javaStack) {
+ this.javaStack = javaStack;
+ var m = javaStack.match(/^([^:]*)/);
+ if(m) name = m[0];
+ }
+ if(name) this.name = name;
+ else this.name = "JSONRpcClientException";
+ this.message = message;
+};
+
+JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490;
+JSONRpcClient.Exception.CODE_ERR_CLIENT = 550;
+JSONRpcClient.Exception.CODE_ERR_PARSE = 590;
+JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591;
+JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592;
+JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593;
+
+JSONRpcClient.Exception.prototype = new Error();
+
+JSONRpcClient.Exception.prototype.toString =
+function JSONRpcClient_Exception_toString(code, msg)
+{
+ return this.name + ": " + this.message;
+};
+
+
+/* Default top level exception handler */
+
+JSONRpcClient.default_ex_handler =
+function JSONRpcClient_default_ex_handler(e) { alert(e); };
+
+
+/* Client settable variables */
+
+JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler;
+JSONRpcClient.profile_async = false;
+JSONRpcClient.max_req_active = 1;
+JSONRpcClient.requestId = 1;
+
+
+/* JSONRpcClient implementation */
+
+JSONRpcClient.prototype._createMethod =
+function JSONRpcClient_createMethod(methodName)
+{
+ var fn=function()
+ {
+ var args = [];
+ var callback = null;
+ for(var i=0;i<arguments.length;i++) args.push(arguments[i]);
+ if(typeof args[0] == "function") callback = args.shift();
+ var req = fn.client._makeRequest.call(fn.client, fn.methodName,
+ args, callback);
+ if(callback == null) {
+ return fn.client._sendRequest.call(fn.client, req);
+ } else {
+ JSONRpcClient.async_requests.push(req);
+ JSONRpcClient.kick_async();
+ return req.requestId;
+ }
+ };
+ fn.client = this;
+ fn.methodName = methodName;
+ return fn;
+};
+
+JSONRpcClient.prototype._addMethods =
+function JSONRpcClient_addMethods(methodNames)
+{
+ for(var i=0; i<methodNames.length; i++) {
+ var obj = this;
+ var names = methodNames[i].split(".");
+ for(var n=0; n<names.length-1; n++) {
+ var name = names[n];
+ if(obj[name]) {
+ obj = obj[name];
+ } else {
+ obj[name] = new Object();
+ obj = obj[name];
+ }
+ }
+ var name = names[names.length-1];
+ if(!obj[name]) {
+ var method = this._createMethod(methodNames[i]);
+ obj[name] = method;
+ }
+ }
+};
+
+JSONRpcClient._getCharsetFromHeaders =
+function JSONRpcClient_getCharsetFromHeaders(http)
+{
+ try {
+ var contentType = http.getResponseHeader("Content-type");
+ var parts = contentType.split(/\s*;\s*/);
+ for(var i =0; i < parts.length; i++) {
+ if(parts[i].substring(0, 8) == "charset=")
+ return parts[i].substring(8, parts[i].length);
+ }
+ } catch (e) {}
+ return "UTF-8"; /* default */
+};
+
+/* Async queue globals */
+JSONRpcClient.async_requests = [];
+JSONRpcClient.async_inflight = {};
+JSONRpcClient.async_responses = [];
+JSONRpcClient.async_timeout = null;
+JSONRpcClient.num_req_active = 0;
+
+JSONRpcClient._async_handler =
+function JSONRpcClient_async_handler()
+{
+ JSONRpcClient.async_timeout = null;
+
+ while(JSONRpcClient.async_responses.length > 0) {
+ var res = JSONRpcClient.async_responses.shift();
+ if(res.canceled) continue;
+ if(res.profile) res.profile.dispatch = new Date();
+ try {
+ res.cb(res.result, res.ex, res.profile);
+ } catch(e) {
+ JSONRpcClient.toplevel_ex_handler(e);
+ }
+ }
+
+ while(JSONRpcClient.async_requests.length > 0 &&
+ JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) {
+ var req = JSONRpcClient.async_requests.shift();
+ if(req.canceled) continue;
+ req.client._sendRequest.call(req.client, req);
+ }
+};
+
+JSONRpcClient.kick_async =
+function JSONRpcClient_kick_async()
+{
+ if(JSONRpcClient.async_timeout == null)
+ JSONRpcClient.async_timeout =
+ setTimeout(JSONRpcClient._async_handler, 0);
+};
+
+JSONRpcClient.cancelRequest =
+function JSONRpcClient_cancelRequest(requestId)
+{
+ /* If it is in flight then mark it as canceled in the inflight map
+ and the XMLHttpRequest callback will discard the reply. */
+ if(JSONRpcClient.async_inflight[requestId]) {
+ JSONRpcClient.async_inflight[requestId].canceled = true;
+ return true;
+ }
+
+ /* If its not in flight yet then we can just mark it as canceled in
+ the the request queue and it will get discarded before being sent. */
+ for(var i in JSONRpcClient.async_requests) {
+ if(JSONRpcClient.async_requests[i].requestId == requestId) {
+ JSONRpcClient.async_requests[i].canceled = true;
+ return true;
+ }
+ }
+
+ /* It may have returned from the network and be waiting for its callback
+ to be dispatched, so mark it as canceled in the response queue
+ and the response will get discarded before calling the callback. */
+ for(var i in JSONRpcClient.async_responses) {
+ if(JSONRpcClient.async_responses[i].requestId == requestId) {
+ JSONRpcClient.async_responses[i].canceled = true;
+ return true;
+ }
+ }
+
+ return false;
+};
+
+JSONRpcClient.prototype._makeRequest =
+function JSONRpcClient_makeRequest(methodName, args, cb)
+{
+ var req = {};
+ req.client = this;
+ req.requestId = JSONRpcClient.requestId++;
+
+ var obj = {};
+ obj.id = req.requestId;
+ if (this.objectID)
+ obj.method = ".obj#" + this.objectID + "." + methodName;
+ else
+ obj.method = methodName;
+ obj.params = args;
+
+ if (cb) req.cb = cb;
+ if (JSONRpcClient.profile_async)
+ req.profile = { "submit": new Date() };
+ req.data = toJSON(obj);
+
+ return req;
+};
+
+JSONRpcClient.prototype._sendRequest =
+function JSONRpcClient_sendRequest(req)
+{
+ if(req.profile) req.profile.start = new Date();
+
+ /* Get free http object from the pool */
+ var http = JSONRpcClient.poolGetHTTPRequest();
+ JSONRpcClient.num_req_active++;
+
+ /* Send the request */
+ if (typeof(this.user) == "undefined") {
+ http.open("POST", this.serverURL, (req.cb != null));
+ } else {
+ http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass);
+ }
+
+ /* setRequestHeader is missing in Opera 8 Beta */
+ try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {}
+
+ /* Construct call back if we have one */
+ if(req.cb) {
+ var self = this;
+ http.onreadystatechange = function() {
+ if(http.readyState == 4) {
+ http.onreadystatechange = function () {};
+ var res = { "cb": req.cb, "result": null, "ex": null};
+ if (req.profile) {
+ res.profile = req.profile;
+ res.profile.end = new Date();
+ }
+ try { res.result = self._handleResponse(http); }
+ catch(e) { res.ex = e; }
+ if(!JSONRpcClient.async_inflight[req.requestId].canceled)
+ JSONRpcClient.async_responses.push(res);
+ delete JSONRpcClient.async_inflight[req.requestId];
+ JSONRpcClient.kick_async();
+ }
+ };
+ } else {
+ http.onreadystatechange = function() {};
+ }
+
+ JSONRpcClient.async_inflight[req.requestId] = req;
+
+ try {
+ http.send(req.data);
+ } catch(e) {
+ JSONRpcClient.poolReturnHTTPRequest(http);
+ JSONRpcClient.num_req_active--;
+ throw new JSONRpcClient.Exception
+ (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
+ }
+
+ if(!req.cb) return this._handleResponse(http);
+};
+
+JSONRpcClient.prototype._handleResponse =
+function JSONRpcClient_handleResponse(http)
+{
+ /* Get the charset */
+ if(!this.charset) {
+ this.charset = JSONRpcClient._getCharsetFromHeaders(http);
+ }
+
+ /* Get request results */
+ var status, statusText, data;
+ try {
+ status = http.status;
+ statusText = http.statusText;
+ data = http.responseText;
+ } catch(e) {
+ JSONRpcClient.poolReturnHTTPRequest(http);
+ JSONRpcClient.num_req_active--;
+ JSONRpcClient.kick_async();
+ throw new JSONRpcClient.Exception
+ (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
+ }
+
+ /* Return http object to the pool; */
+ JSONRpcClient.poolReturnHTTPRequest(http);
+ JSONRpcClient.num_req_active--;
+
+ /* Unmarshall the response */
+ if(status != 200) {
+ throw new JSONRpcClient.Exception(status, statusText);
+ }
+ var obj;
+ try {
+ eval("obj = " + data);
+ } catch(e) {
+ throw new JSONRpcClient.Exception(550, "error parsing result");
+ }
+ if(obj.error)
+ throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg,
+ obj.error.trace);
+ var res = obj.result;
+
+ /* Handle CallableProxy */
+ if(res && res.objectID && res.JSONRPCType == "CallableReference")
+ return new JSONRpcClient(this.serverURL, this.user,
+ this.pass, res.objectID);
+
+ return res;
+};
+
+
+/* XMLHttpRequest wrapper code */
+
+/* XMLHttpRequest pool globals */
+JSONRpcClient.http_spare = [];
+JSONRpcClient.http_max_spare = 8;
+
+JSONRpcClient.poolGetHTTPRequest =
+function JSONRpcClient_pool_getHTTPRequest()
+{
+ if(JSONRpcClient.http_spare.length > 0) {
+ return JSONRpcClient.http_spare.pop();
+ }
+ return JSONRpcClient.getHTTPRequest();
+};
+
+JSONRpcClient.poolReturnHTTPRequest =
+function JSONRpcClient_poolReturnHTTPRequest(http)
+{
+ if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare)
+ delete http;
+ else
+ JSONRpcClient.http_spare.push(http);
+};
+
+JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
+ "MSXML2.XMLHTTP.4.0",
+ "MSXML2.XMLHTTP.3.0",
+ "MSXML2.XMLHTTP",
+ "Microsoft.XMLHTTP" ];
+
+JSONRpcClient.getHTTPRequest =
+function JSONRpcClient_getHTTPRequest()
+{
+ /* Mozilla XMLHttpRequest */
+ try {
+ JSONRpcClient.httpObjectName = "XMLHttpRequest";
+ return new XMLHttpRequest();
+ } catch(e) {}
+
+ /* Microsoft MSXML ActiveX */
+ for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) {
+ try {
+ JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i];
+ return new ActiveXObject(JSONRpcClient.msxmlNames[i]);
+ } catch (e) {}
+ }
+
+ /* None found */
+ JSONRpcClient.httpObjectName = null;
+ throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object");
+};
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.java
new file mode 100644
index 0000000000..584228abde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/Echo.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.binding.jsonrpc;
+
+/**
+ * Interface of our sample JSONRPC service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.java
new file mode 100644
index 0000000000..e63cafd6a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/EchoComponentImpl.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.binding.jsonrpc;
+
+
+
+/**
+ * A simple client component that uses a reference with an JSONRPC binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ public String echo(String msg) {
+ System.out.println("Echo: "+ msg);
+ return "echo: " + msg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
new file mode 100644
index 0000000000..898807c7ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.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.binding.jsonrpc;
+
+import java.io.ByteArrayInputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.json.JSONObject;
+
+import com.meterware.httpunit.PostMethodWebRequest;
+import com.meterware.httpunit.WebConversation;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+/**
+ * @version $Rev: 536083 $ $Date: 2007-05-08 02:18:29 -0400 (Tue, 08 May 2007) $
+ */
+public class JSONRPCServiceTestCase extends TestCase {
+
+ private static final String SERVICE_PATH = "/EchoService";
+ private static final String SERVICE_URL = "http://localhost:8080/" + SERVICE_PATH;
+ private SCADomain domain;
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("JSONRPCBinding.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void testJSONRPCBinding() throws Exception {
+ JSONObject jsonRequest = new JSONObject("{ \"method\": \"echo\", \"params\": [\"Hello JSON-RPC\"], \"id\": 1}");
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
+ WebResponse response = wc.getResource(request);
+
+ assertEquals(200, response.getResponseCode());
+ JSONObject jsonResp = new JSONObject(response.getText());
+ assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/.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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/pom.xml
new file mode 100755
index 0000000000..3953552b03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <name>Apache Tuscany Java RMI Binding</name>
+
+ <dependencies>
+ <!-- FIXME: The MessageFactoryImpl is in tuscany-core -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/DefaultRMIBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/DefaultRMIBindingFactory.java
new file mode 100644
index 0000000000..bc92dba962
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/DefaultRMIBindingFactory.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.binding.rmi;
+
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev: 526508 $ $Date: 2007-04-08 07:42:42 +0530 (Sun, 08 Apr 2007) $
+ */
+public class DefaultRMIBindingFactory implements RMIBindingFactory {
+
+ public DefaultRMIBindingFactory() {
+ }
+
+ public RMIBinding createRMIBinding() {
+ return new RMIBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodException.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodException.java
new file mode 100644
index 0000000000..874a2ca066
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodException.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.sca.binding.rmi;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NoRemoteMethodException extends RuntimeException {
+
+ private static final long serialVersionUID = -4706646034473965972L;
+
+ public NoRemoteMethodException() {
+ }
+
+ public NoRemoteMethodException(String message) {
+ super(message);
+ }
+
+ public NoRemoteMethodException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoRemoteMethodException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceException.java
new file mode 100644
index 0000000000..81b51c7e53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceException.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.sca.binding.rmi;
+
+/**
+ */
+public class NoRemoteServiceException extends RMIRuntimeException {
+ private static final long serialVersionUID = 4940083022809126473L;
+
+ public NoRemoteServiceException() {
+ }
+
+ public NoRemoteServiceException(String message) {
+ super(message);
+ }
+
+ public NoRemoteServiceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoRemoteServiceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java
new file mode 100644
index 0000000000..d01c26f368
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java
@@ -0,0 +1,55 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tuscany.sca.binding.rmi;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * Represents a binding to an RMI service.
+ */
+public interface RMIBinding extends Binding {
+ /**
+ * @return the host name of the RMI Service
+ */
+ String getRmiHostName();
+
+ /**
+ * @param rmiHostName the hostname of the RMI Service
+ */
+ void setRmiHostName(String rmiHostName);
+
+ /**
+ * @return the port number for the RMI Service
+ */
+ String getRmiPort();
+
+ /**
+ * @param rmiPort the port number for the RMI Service
+ */
+ void setRmiPort(String rmiPort);
+
+ /**
+ * @return returns the RMI Service Name
+ */
+ String getRmiServiceName();
+
+ /**
+ * Sets the service name for the RMI Server
+ * @param rmiServiceName the name of the RMI service
+ */
+ void setRmiServiceName(String rmiServiceName);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingConstants.java
new file mode 100644
index 0000000000..e350386ca0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingConstants.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.binding.rmi;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface RMIBindingConstants {
+
+ String BINDING_RMI = "binding.rmi";
+ QName BINDING_RMI_QNAME = new QName(Constants.SCA10_NS, BINDING_RMI);
+ String RMI_HOST = "host";
+ String RMI_PORT = "port";
+ String RMI_SERVICE = "serviceName";
+
+ String COLON = ":";
+ String FWD_SLASH = "/";
+ String LOCAL_HOST = "localhost";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java
new file mode 100644
index 0000000000..199b4053e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.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.binding.rmi;
+
+/**
+ * Factory for the RMI binding model.
+ */
+public interface RMIBindingFactory {
+
+ /**
+ * Creates a new RMI binding.
+ *
+ * @return a new RMI binding
+ */
+ RMIBinding createRMIBinding();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingImpl.java
new file mode 100644
index 0000000000..144bc3623a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingImpl.java
@@ -0,0 +1,129 @@
+/**
+ *
+ * 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.sca.binding.rmi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+
+/**
+ * Represents a binding to an RMI service.
+ *
+ * @version $Rev: 490475 $ $Date: 2006-12-27 15:53:42 +0530 (Wed, 27 Dec 2006) $
+ */
+public class RMIBindingImpl implements RMIBinding, RMIBindingConstants {
+ private String name;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private String host;
+ private String port;
+ private String serviceName;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ protected RMIBindingImpl() {
+ }
+
+ public String getURI() {
+ return host + COLON + port + serviceName;
+ }
+
+ public String getRmiHostName() {
+ if (host == null) {
+ extractFromUri();
+ }
+ return host;
+ }
+
+ public void setRmiHostName(String host) {
+ this.host = host;
+ }
+
+ public String getRmiPort() {
+ if (port == null) {
+ extractFromUri();
+ }
+ return port;
+ }
+
+ public void setRmiPort(String port) {
+ this.port = port;
+ }
+
+ public String getRmiServiceName() {
+ if (serviceName == null) {
+ extractFromUri();
+ }
+ return serviceName;
+ }
+
+ public void setRmiServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ private void extractFromUri() {
+ if (getURI() != null && getURI().length() > 0) {
+ int colonIndex = getURI().indexOf(COLON);
+ if (colonIndex != -1) {
+ setRmiHostName(getURI().substring(0, colonIndex));
+ setRmiPort(getURI().substring(colonIndex + 1));
+ }
+
+ int slashIndex = getURI().indexOf(FWD_SLASH);
+ if (slashIndex != -1) {
+ if (colonIndex == -1) {
+ setRmiHostName(getURI().substring(0, slashIndex));
+ }
+ setRmiServiceName(getURI().substring(slashIndex + 1));
+ } else {
+ setRmiServiceName(getURI());
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingInvoker.java
new file mode 100644
index 0000000000..50ff9233ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingInvoker.java
@@ -0,0 +1,83 @@
+/**
+ * * 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.sca.binding.rmi;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.rmi.RMIHost;
+import org.apache.tuscany.sca.rmi.RMIHostException;
+
+public class RMIBindingInvoker implements Invoker {
+ private RMIHost rmiHost;
+ private String host;
+ private String port;
+ private String svcName;
+ private Method remoteMethod;
+ private Remote proxy;
+
+ public RMIBindingInvoker(RMIHost rmiHost, String host, String port, String svcName, Method remoteMethod) {
+ this.rmiHost = rmiHost;
+ this.remoteMethod = remoteMethod;
+ this.host = host;
+ this.port = port;
+ this.svcName = svcName;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = invokeTarget(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+
+ public Object invokeTarget(final Object payload) throws InvocationTargetException {
+ try {
+ if (proxy == null) {
+ proxy = rmiHost.findService(host, port, svcName);
+ // proxy = Naming.lookup(serviceURI);
+ }
+ remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(), remoteMethod.getParameterTypes());
+
+ if (payload != null && !payload.getClass().isArray()) {
+ return remoteMethod.invoke(proxy, payload);
+ } else {
+ return remoteMethod.invoke(proxy, (Object[])payload);
+
+ }
+ } catch (RMIHostException e) {
+ // the method we are passed must be accessible
+ throw new AssertionError(e);
+ } catch (IllegalAccessException e) {
+ // the method we are passed must be accessible
+ throw new AssertionError(e);
+ } catch (NoSuchMethodException e) {
+ throw new AssertionError(e);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProvider.java
new file mode 100644
index 0000000000..b22ddd936a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProvider.java
@@ -0,0 +1,244 @@
+/**
+ *
+ * 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.sca.binding.rmi;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.rmi.Remote;
+import java.rmi.server.UnicastRemoteObject;
+
+import net.sf.cglib.asm.ClassWriter;
+import net.sf.cglib.asm.Constants;
+import net.sf.cglib.asm.Type;
+import net.sf.cglib.proxy.Enhancer;
+import net.sf.cglib.proxy.MethodInterceptor;
+import net.sf.cglib.proxy.MethodProxy;
+
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.rmi.RMIHost;
+import org.apache.tuscany.sca.rmi.RMIHostException;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * RMIBindingProvider
+ */
+public class RMIBindingProvider implements ReferenceBindingProvider, ServiceBindingProvider, MethodInterceptor {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private RuntimeComponentReference reference;
+ private RMIBinding binding;
+ private MessageFactory messageFactory;
+ private RMIHost rmiHost;
+
+ // need this member to morph the service interface to extend from Remote if
+ // it does not
+ // the base class's member variable interfaze is to be maintained to enable
+ // the connection
+ // of the service outbound to the component's inbound wire which requires
+ // that the service
+ // and the component match in their service contracts.
+ private Interface serviceInterface;
+
+ public RMIBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ RMIBinding binding,
+ MessageFactory messageFactory,
+ RMIHost rmiHost) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.rmiHost = rmiHost;
+ this.messageFactory = messageFactory;
+ }
+
+ public RMIBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ RMIBinding binding,
+ RMIHost rmiHost) {
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+ this.rmiHost = rmiHost;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (service != null)
+ return service.getInterfaceContract();
+ else
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ if (service != null) {
+ URI uri = URI.create(component.getURI() + "/" + binding.getName());
+ binding.setURI(uri.toString());
+
+ this.serviceInterface = service.getInterfaceContract().getInterface();
+
+ Remote rmiProxy = createRmiService();
+
+ try {
+ rmiHost.registerService(binding.getRmiServiceName(), getPort(binding.getRmiPort()), rmiProxy);
+ } catch (RMIHostException e) {
+ throw new NoRemoteServiceException(e);
+ }
+ }
+ }
+
+ public void stop() {
+ if (service != null) {
+ try {
+ rmiHost.unregisterService(binding.getRmiServiceName(), getPort(binding.getRmiPort()));
+ } catch (RMIHostException e) {
+ throw new NoRemoteServiceException(e.getMessage());
+ }
+ }
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ try {
+ Method remoteMethod = JavaInterfaceUtil.findMethod(((JavaInterface)reference.getInterfaceContract()
+ .getInterface()).getJavaClass(), operation);
+ return new RMIBindingInvoker(rmiHost, binding.getRmiHostName(), binding.getRmiPort(), binding
+ .getRmiServiceName(), remoteMethod);
+ } catch (NoSuchMethodException e) {
+ throw new NoRemoteMethodException(operation.toString(), e);
+ }
+ }
+
+ protected Remote createRmiService() {
+ Enhancer enhancer = new Enhancer();
+ enhancer.setSuperclass(UnicastRemoteObject.class);
+ enhancer.setCallback(this);
+ Class targetJavaInterface = getTargetJavaClass(serviceInterface);
+ if (!Remote.class.isAssignableFrom(targetJavaInterface)) {
+ RMIServiceClassLoader classloader = new RMIServiceClassLoader(getClass().getClassLoader());
+ final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
+ targetJavaInterface = classloader.defineClass(byteCode);
+ enhancer.setClassLoader(classloader);
+ }
+ enhancer.setInterfaces(new Class[] {targetJavaInterface});
+ return (Remote)enhancer.create();
+ }
+
+ // if the interface of the component whose serviceBindings must be exposed
+ // as RMI Service, does not
+ // implement java.rmi.Remote, then generate such an interface. This method
+ // will stop with
+ // just generating the bytecode. Defining the class from the byte code must
+ // tbe the responsibility
+ // of the caller of this method, since it requires a classloader to be
+ // created to define and load
+ // this interface.
+ protected byte[] generateRemoteInterface(Class serviceInterface) {
+ String interfazeName = serviceInterface.getCanonicalName();
+ ClassWriter cw = new ClassWriter(false);
+
+ String simpleName = serviceInterface.getSimpleName();
+ cw.visit(Constants.V1_5, Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT + Constants.ACC_INTERFACE, interfazeName
+ .replace('.', '/'), "java/lang/Object", new String[] {"java/rmi/Remote"}, simpleName + ".java");
+
+ StringBuffer argsAndReturn = null;
+ Method[] methods = serviceInterface.getMethods();
+ for (Method method : methods) {
+ argsAndReturn = new StringBuffer("(");
+ Class[] paramTypes = method.getParameterTypes();
+ Class returnType = method.getReturnType();
+
+ for (Class paramType : paramTypes) {
+ argsAndReturn.append(Type.getType(paramType));
+ }
+ argsAndReturn.append(")");
+ argsAndReturn.append(Type.getType(returnType));
+
+ cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
+ method.getName(),
+ argsAndReturn.toString(),
+ new String[] {"java/rmi/RemoteException"},
+ null);
+ }
+ cw.visitEnd();
+ return cw.toByteArray();
+ }
+
+ public Object intercept(Object object, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
+ // since incoming method signatures have 'remotemethod invocation' it
+ // will not match with the
+ // wired component's method signatures. Hence need to pull in the
+ // corresponding method from the
+ // component's service contract interface to make this invocation.
+
+ return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
+ }
+
+ public Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
+
+ Message requestMsg = messageFactory.createMessage();
+ ThreadMessageContext.setMessageContext(requestMsg);
+ requestMsg.setBody(args);
+
+ Message responseMsg = service.getInvoker(binding, op).invoke(requestMsg);
+
+ if (responseMsg.isFault()) {
+ throw new InvocationTargetException((Throwable)responseMsg.getBody());
+ }
+ return responseMsg.getBody();
+ }
+
+ protected int getPort(String port) {
+ int portNumber = RMIHost.RMI_DEFAULT_PORT;
+ if (port != null && port.length() > 0) {
+ portNumber = Integer.decode(port);
+ }
+
+ return portNumber;
+ }
+
+ private Class<?> getTargetJavaClass(Interface targetInterface) {
+ // TODO: right now assume that the target is always a Java
+ // Implementation. Need to figure out
+ // how to generate Java Interface in cases where the target is not a
+ // Java Implementation
+ return ((JavaInterface)targetInterface).getJavaClass();
+ }
+
+ private class RMIServiceClassLoader extends ClassLoader {
+ public RMIServiceClassLoader(ClassLoader parent) {
+ super(parent);
+ }
+
+ public Class defineClass(byte[] byteArray) {
+ return defineClass(null, byteArray, 0, byteArray.length);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProviderFactory.java
new file mode 100644
index 0000000000..604eae3ab0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingProviderFactory.java
@@ -0,0 +1,57 @@
+/**
+ *
+ * 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.sca.binding.rmi;
+
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.rmi.RMIHost;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+/**
+ *
+ * RMIBindingProvider
+ *
+ * @version $Rev$ $Date$
+ */
+public class RMIBindingProviderFactory implements BindingProviderFactory<RMIBinding> {
+
+ private RMIHost rmiHost;
+ private MessageFactory messageFactory;
+
+ public RMIBindingProviderFactory(MessageFactory messageFactory, RMIHost rmiHost) {
+ this.rmiHost = rmiHost;
+ this.messageFactory = messageFactory;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, RMIBinding binding) {
+ return new RMIBindingProvider(component, reference, binding, rmiHost);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, RMIBinding binding) {
+ return new RMIBindingProvider(component, service, binding, messageFactory, rmiHost);
+ }
+
+ public Class<RMIBinding> getModelType() {
+ return RMIBinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIModuleActivator.java
new file mode 100644
index 0000000000..aaf77bbf66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIModuleActivator.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.binding.rmi;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.binding.rmi.xml.RMIBindingProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.rmi.RMIHost;
+
+public class RMIModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = factories.getFactory(PolicyFactory.class);
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ StAXArtifactProcessorExtensionPoint processors =
+ registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ RMIHost rmiHost = registry.getExtensionPoint(RMIHost.class);
+ RMIBindingFactory rmiFactory = new DefaultRMIBindingFactory();
+ processors.addArtifactProcessor(new RMIBindingProcessor(assemblyFactory, policyFactory, rmiFactory));
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new RMIBindingProviderFactory(messageFactory, rmiHost));
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIRuntimeException.java
new file mode 100644
index 0000000000..79382c75c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIRuntimeException.java
@@ -0,0 +1,37 @@
+/**
+ *
+ * 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.sca.binding.rmi;
+
+
+/**
+ */
+public abstract class RMIRuntimeException extends RuntimeException {
+ protected RMIRuntimeException() {
+ }
+
+ protected RMIRuntimeException(String message) {
+ super(message);
+ }
+
+ protected RMIRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected RMIRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/xml/RMIBindingProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/xml/RMIBindingProcessor.java
new file mode 100644
index 0000000000..0a33e00548
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/xml/RMIBindingProcessor.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.tuscany.sca.binding.rmi.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+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.assembly.xml.Constants;
+import org.apache.tuscany.sca.binding.rmi.RMIBinding;
+import org.apache.tuscany.sca.binding.rmi.RMIBindingConstants;
+import org.apache.tuscany.sca.binding.rmi.RMIBindingFactory;
+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.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class RMIBindingProcessor implements
+ StAXArtifactProcessor<RMIBinding>, RMIBindingConstants {
+
+ private RMIBindingFactory rmiBindingFactory;
+ private PolicyFactory policyFactory;
+
+ public RMIBindingProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ RMIBindingFactory rmiBindingFactory) {
+ this.policyFactory = policyFactory;
+ this.rmiBindingFactory = rmiBindingFactory;
+ }
+
+ public RMIBinding read(XMLStreamReader reader) throws ContributionReadException {
+ try {
+ RMIBinding rmiBinding = rmiBindingFactory.createRMIBinding();
+
+ //Read policies
+ readPolicies(rmiBinding, reader);
+
+ //Read host, port and service name
+ rmiBinding.setRmiHostName(reader.getAttributeValue(null, RMI_HOST));
+ rmiBinding.setRmiPort(reader.getAttributeValue(null, RMI_PORT));
+ rmiBinding.setRmiServiceName(reader.getAttributeValue(null, RMI_SERVICE));
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && BINDING_RMI_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return rmiBinding;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(RMIBinding rmiBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write a <binding.ws>
+ writer.writeStartElement(Constants.SCA10_NS, BINDING_RMI);
+
+ if (rmiBinding.getRmiHostName() != null) {
+ writer.writeAttribute(RMIBindingConstants.RMI_HOST, rmiBinding.getRmiHostName());
+ }
+
+ if (rmiBinding.getRmiPort() != null) {
+ writer.writeAttribute(RMIBindingConstants.RMI_PORT, rmiBinding.getRmiPort());
+ }
+
+ if (rmiBinding.getRmiServiceName() != null) {
+ writer.writeAttribute(RMIBindingConstants.RMI_SERVICE, rmiBinding.getRmiServiceName());
+ }
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(RMIBinding model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public QName getArtifactType() {
+ return RMIBindingConstants.BINDING_RMI_QNAME;
+ }
+
+ public Class<RMIBinding> getModelType() {
+ return RMIBinding.class;
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ private void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ requiredIntents.add(intent);
+ }
+ }
+
+ value = reader.getAttributeValue(null, Constants.POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ policySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Returns a qname from a string.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..9cc4a2ed7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.rmi.RMIModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..acb81a00f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldImpl.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 helloworld;
+
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+ public String sayHello(String name) {
+ return "Hello from the RMI Service to - " + name;
+ }
+
+ public String sayHi(String name, String greeter) {
+ return "Hi from " + greeter + " in RMI Service to - " + name;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.java
new file mode 100644
index 0000000000..73aedc3b6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiImpl.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 helloworld;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldRmiService.class)
+public class HelloWorldRmiImpl implements HelloWorldRmiService {
+ private HelloWorldService extService;
+
+ public HelloWorldService getExtService() {
+ return extService;
+ }
+
+ @Reference
+ public void setExtService(HelloWorldService extService) {
+ this.extService = extService;
+ }
+
+ public String sayRmiHello(String name) {
+ return extService.sayHello(name) + " thro the RMI Reference";
+ }
+
+ public String sayRmiHi(String name, String greeter) {
+ return extService.sayHi(name, greeter) + " thro the RMI Reference";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.java
new file mode 100644
index 0000000000..f636c8f7d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldRmiService.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 helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldRmiService {
+
+ String sayRmiHello(String name);
+ String sayRmiHi(String name, String greeter);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..d5dc509f3e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/helloworld/HelloWorldService.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 helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+ String sayHello(String name);
+ String sayHi(String name, String greeter);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java
new file mode 100644
index 0000000000..e9991185a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.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 org.apache.tuscany.sca.binding.rmi;
+
+import helloworld.HelloWorldRmiService;
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class BindingTestCase {
+ private static HelloWorldRmiService helloWorldRmiService;
+ private static SCADomain domain;
+
+ @Test
+ public void testRmiService() {
+ System.out.println(helloWorldRmiService.sayRmiHello("Tuscany World!"));
+ Assert.assertEquals("Hello from the RMI Service to - Tuscany World! thro the RMI Reference",
+ helloWorldRmiService.sayRmiHello("Tuscany World!"));
+
+ System.out.println(helloWorldRmiService.sayRmiHi("Tuscany World!", "Apache World"));
+
+ Assert.assertEquals("Hi from Apache World in RMI Service to - Tuscany World! thro the RMI Reference",
+ helloWorldRmiService.sayRmiHi("Tuscany World!", "Apache World"));
+ }
+
+
+
+ @BeforeClass
+ public static void init() throws Exception {
+ domain = SCADomain.newInstance("RMIBindingTest.composite");
+ helloWorldRmiService =
+ domain.getService(HelloWorldRmiService.class, "HelloWorldRmiServiceComponent");
+ }
+
+ @AfterClass
+ public static void destroy() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodExceptionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodExceptionTestCase.java
new file mode 100644
index 0000000000..3f9aa9950f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteMethodExceptionTestCase.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.binding.rmi;
+
+import junit.framework.TestCase;
+
+public class NoRemoteMethodExceptionTestCase extends TestCase {
+
+ public void testNoArgs() {
+ assertNotNull(new NoRemoteMethodException());
+ }
+
+ public void testMsgArg() {
+ NoRemoteMethodException e = new NoRemoteMethodException("foo");
+ assertEquals("foo", e.getMessage());
+ }
+
+ public void test2Args() {
+ Exception cause = new Exception();
+ NoRemoteMethodException e = new NoRemoteMethodException("foo", cause);
+ assertEquals("foo", e.getMessage());
+ assertEquals(cause, e.getCause());
+ }
+
+ public void testCauseArgs() {
+ Exception cause = new Exception();
+ NoRemoteMethodException e = new NoRemoteMethodException(cause);
+ assertEquals(cause, e.getCause());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceExceptionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceExceptionTestCase.java
new file mode 100644
index 0000000000..d4de9996de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/java/org/apache/tuscany/sca/binding/rmi/NoRemoteServiceExceptionTestCase.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.binding.rmi;
+
+import junit.framework.TestCase;
+
+public class NoRemoteServiceExceptionTestCase extends TestCase {
+
+ public void testNoArgs() {
+ assertNotNull(new NoRemoteServiceException());
+ }
+
+ public void testMsgArg() {
+ NoRemoteServiceException e = new NoRemoteServiceException("foo");
+ assertEquals("foo", e.getMessage());
+ }
+
+ public void test2Args() {
+ Exception cause = new Exception();
+ NoRemoteServiceException e = new NoRemoteServiceException("foo", cause);
+ assertEquals("foo", e.getMessage());
+ assertEquals(cause, e.getCause());
+ }
+
+ public void testCauseArgs() {
+ Exception cause = new Exception();
+ NoRemoteServiceException e = new NoRemoteServiceException(cause);
+ assertEquals(cause, e.getCause());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType
new file mode 100644
index 0000000000..224a68f88d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <service name="HelloWorldService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </service>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType
new file mode 100644
index 0000000000..a83e7e6d1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/HelloWorldRmiImpl.componentType
@@ -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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldRmiService">
+ <interface.java interface="helloworld.HelloWorldRmiService"/>
+ </service>
+ <reference name="extService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ </reference>
+</componentType>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/META-INF/NOTICE
@@ -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/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/RMIBindingTest.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/RMIBindingTest.composite
new file mode 100644
index 0000000000..9f7b2548bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-rmi/src/test/resources/RMIBindingTest.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:rmi="http://tuscany.apache.org/xmlns/binding/rmi/1.0-SNAPSHOT"
+ name="HelloWorldRmiComposite">
+
+ <service name="HelloWorldRmiService" promote="HelloWorldServiceComponent">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ <reference target="HelloWorldServiceComponent">HelloWorldServiceComponent</reference>
+ </service>
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldImpl"/>
+ </component>
+
+ <component name="HelloWorldRmiServiceComponent">
+ <implementation.java class="helloworld.HelloWorldRmiImpl"/>
+ <reference name="extService"></reference>
+ </component>
+
+ <reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService">
+ <interface.java interface="helloworld.HelloWorldService"/>
+ <binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/pom.xml
new file mode 100755
index 0000000000..3807157bef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <name>Apache Tuscany Web Services Binding using Apache Axis2</name>
+
+ <repositories>
+ <repository>
+ <id>apache.ws</id>
+ <name>Apache WebServices Repository</name>
+ <url>http://ws.zones.apache.org/repository/</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.woden</groupId>
+ <artifactId>woden</artifactId>
+ <version>1.0-incubating-M7a</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ <version>1.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>2.2</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/assembly/axis2.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/assembly/axis2.xml
new file mode 100644
index 0000000000..52a61790ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/assembly/axis2.xml
@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <parameter name="enableSwA" locked="false">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments" locked="false">true</parameter>
+ <parameter name="attachmentDIR" locked="false"></parameter>
+ <parameter name="sizeThreshold" locked="false">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in seconds-->
+ <parameter name="ConfigContextTimeoutInterval" locked="false">30</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults" locked="false">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason" locked="false">false</parameter>
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot" locked="false">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distingiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath" locked="false">services</parameter>-->
+ <!--<parameter name="restPath" locked="false">rest</parameter>-->
+
+
+ <!--Set the flag to true if you want to enable transport level session mangment-->
+ <parameter name="manageTransportSession" locked="false">false</parameter>
+
+ <!--Following two parameters will be used to handle REST in Axis2. The default settings will make Axis2 to have two-->
+ <!--different endpoints, one for REST (AxisRESTServlet) one for SOAP message handling (AxisServlet). But following-->
+ <!--parameters help to tweak the message handling of two main servlets. -->
+
+ <!-- If the enableRESTInAxis2MainServlet is true, then Axis2MainServlet will handle both SOAP and REST messages -->
+ <parameter name="enableRESTInAxis2MainServlet" locked="true">true</parameter>
+
+ <!-- Following parameter will completely disable REST handling in both the servlets-->
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!-- This will disable the separate servlet we have for REST handling. -->
+ <parameter name="disableSeparateEndpointForREST" locked="true">false</parameter>
+
+ <!-- If you have a frontend host which exposes this webservice using a different public URL -->
+ <!-- use this parameter to override autodetected url -->
+ <!--<parameter name="httpFrontendHostUrl" locked="false">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInOutAsyncMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills us (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname" locked="false">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer" locked="false">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout" locked="false">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay" locked="false">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize" locked="false">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize" locked="false">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime" locked="false">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit" locked="false">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have SMTP transport support-->
+ <!--<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">-->
+ <!--<parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>-->
+ <!--<parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.port" locked="false">110</parameter>-->
+ <!--<parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>-->
+ <!--</transportReceiver>-->
+
+ <transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncommet following paramter , and set as you required.-->
+ <!--<parameter name="hostname" locked="false">tcp://myApp.com/ws</parameter>-->
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+
+ <!-- Commented out by Tuscany
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <!-- Commented out by Tuscany
+ <module ref="addressing"/>
+ -->
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+ <handler name="TuscanyDispatcher"
+ class="org.apache.tuscany.sca.binding.axis2.TuscanyDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2AsyncBindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2AsyncBindingInvoker.java
new file mode 100644
index 0000000000..e2517e02d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2AsyncBindingInvoker.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.sca.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.CountDownLatch;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+
+public class Axis2AsyncBindingInvoker extends Axis2BindingInvoker {
+
+ private Axis2ReferenceCallbackTargetInvoker callbackInvoker;
+
+ public Axis2AsyncBindingInvoker(ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory) {
+ super(serviceClient, wsdlOperationName, options, soapFactory);
+ }
+
+ private Object invokeTarget(final Object payload, String conversationId)
+ throws InvocationTargetException {
+ try {
+ Object[] args = (Object[]) payload;
+ OperationClient operationClient = createOperationClient(args, conversationId);
+ Axis2ReferenceCallback callback = new Axis2ReferenceCallback(callbackInvoker);
+ operationClient.setCallback(callback);
+
+ // FIXME Synchronize with callback thread to get return value
+ CountDownLatch doneSignal = new CountDownLatch(1);
+ callbackInvoker.setSignal(doneSignal);
+
+ operationClient.execute(false);
+
+ try {
+ doneSignal.await();
+ } catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+
+ // FIXME returning value from callback thread
+ Object response = callbackInvoker.getReturnPayload();
+ return response;
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public void setCallbackTargetInvoker(Axis2ReferenceCallbackTargetInvoker callbackInvoker) {
+ this.callbackInvoker = callbackInvoker;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingInvoker.java
new file mode 100644
index 0000000000..fe33416f8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingInvoker.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.Constants;
+
+/**
+ * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service
+ */
+public class Axis2BindingInvoker implements Invoker {
+
+ private ServiceClient serviceClient;
+ private QName wsdlOperationName;
+ private Options options;
+ private SOAPFactory soapFactory;
+
+ public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA_NS,"conversationID");
+
+ public Axis2BindingInvoker(ServiceClient serviceClient, QName wsdlOperationName,
+ Options options, SOAPFactory soapFactory) {
+ this.serviceClient = serviceClient;
+ this.wsdlOperationName = wsdlOperationName;
+ this.options = options;
+ this.soapFactory = soapFactory;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ // getCallbackUris() has been removed from the Message interface
+ // LinkedList<URI> callbackRoutingChain = msg.getCallbackUris();
+ // if (callbackRoutingChain != null) {
+ // workContext.setCallbackUris(callbackRoutingChain);
+ // }
+ Object resp = invokeTarget(msg.getBody(), msg.getConversationSequence(), msg.getConversationID());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ protected Object invokeTarget(final Object payload, final ConversationSequence sequence, String conversationId) throws InvocationTargetException {
+ try {
+
+ Object[] args = (Object[]) payload;
+ OperationClient operationClient = createOperationClient(args, conversationId);
+
+ // ensure connections are tracked so that they can be closed by the reference binding
+ MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
+ requestMC.getOptions().setTimeOutInMilliSeconds(120000L);
+
+ operationClient.execute(true);
+
+ MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+ operationClient.complete(requestMC);
+
+ return responseMC.getEnvelope().getBody().getFirstElement();
+
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected OperationClient createOperationClient(Object[] args, String conversationId) throws AxisFault {
+ SOAPEnvelope env = soapFactory.getDefaultEnvelope();
+ if (args != null && args.length > 0) {
+ SOAPBody body = env.getBody();
+ for (Object bc : args) {
+ if (bc instanceof OMElement) {
+ body.addChild((OMElement) bc);
+ } else {
+ throw new IllegalArgumentException(
+ "Can't handle mixed payloads betweem OMElements and other types.");
+ }
+ }
+ }
+ MessageContext requestMC = new MessageContext();
+ requestMC.setEnvelope(env);
+
+ // Axis2 operationClients can not be shared so create a new one for each request
+ OperationClient operationClient = serviceClient.createClient(wsdlOperationName);
+
+ if (conversationId != null && conversationId.length() != 0) {
+ EndpointReference fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+ fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId);
+ options.setFrom(fromEPR);
+ requestMC.setFrom(fromEPR); //who knows why two ways ?
+
+ //For now do this the brute force method. Need to figure out how to do axis addressing .. configure mar in flow.
+ SOAPEnvelope sev = requestMC.getEnvelope();
+ SOAPHeader sh = sev.getHeader();
+ OMElement el = fromEPR.toOM(AddressingConstants.Final.WSA_NAMESPACE,
+ AddressingConstants.WSA_FROM,
+ AddressingConstants.WSA_DEFAULT_PREFIX);
+ sh.addChild(el);
+ }
+
+ operationClient.setOptions(options);
+ operationClient.addMessageContext(requestMC);
+
+ return operationClient;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingProviderFactory.java
new file mode 100644
index 0000000000..f6631d7e1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2BindingProviderFactory.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.binding.axis2;
+
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Axis2BindingProviderFactory
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class Axis2BindingProviderFactory implements BindingProviderFactory<WebServiceBinding> {
+
+ private MessageFactory messageFactory;
+ private ServletHost servletHost;
+
+ public Axis2BindingProviderFactory(ServletHost servletHost, MessageFactory messageFactory) {
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, WebServiceBinding binding) {
+ return new Axis2ReferenceBindingProvider(component, reference, binding, messageFactory);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, WebServiceBinding binding) {
+ return new Axis2ServiceBindingProvider(component, service, binding, servletHost, messageFactory);
+ }
+
+ public Class<WebServiceBinding> getModelType() {
+ return WebServiceBinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2CallbackInvocationHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2CallbackInvocationHandler.java
new file mode 100644
index 0000000000..91d0f05bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2CallbackInvocationHandler.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.sca.binding.axis2;
+
+import java.net.URI;
+import java.util.LinkedList;
+
+import org.apache.tuscany.sca.core.invocation.AbstractInvocationHandler;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class Axis2CallbackInvocationHandler extends AbstractInvocationHandler {
+
+ private RuntimeWire wire;
+
+ public Axis2CallbackInvocationHandler(MessageFactory messageFactory, RuntimeWire wire) {
+ super(messageFactory, false);
+ this.wire = wire;
+ }
+
+ public Object invoke(Operation operation, Object[] args, LinkedList<URI> callbackRoutingChain) throws Throwable {
+// Object targetAddress = callbackRoutingChain.removeFirst();
+// if (targetAddress == null) {
+// throw new AssertionError("Popped a null from address from stack");
+// }
+
+// //TODO optimize as this is slow in local invocations
+// Map<Operation, InvocationChain> sourceCallbackInvocationChains =
+// wire.getCallbackInvocationChains();
+// InvocationChain chain = sourceCallbackInvocationChains.get(operation);
+// chain.g
+// TargetInvoker invoker = chain.getTargetInvoker();
+// return invoke(chain, invoker, args, null, callbackRoutingChain, null);
+ throw new UnsupportedOperationException("not yet implemented");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ModuleActivator.java
new file mode 100644
index 0000000000..50e916c084
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ModuleActivator.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.binding.axis2;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.xml.WebServiceBindingProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.DefaultWSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+public class Axis2ModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = factories.getFactory(PolicyFactory.class);
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ WebServiceBindingFactory wsFactory = new DefaultWebServiceBindingFactory();
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ WSDLInterfaceIntrospector introspector = new DefaultWSDLInterfaceIntrospector(wsdlFactory);
+ WebServiceBindingProcessor processor =
+ new WebServiceBindingProcessor(assemblyFactory, policyFactory, wsFactory, wsdlFactory, introspector);
+ processors.addArtifactProcessor(processor);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ ServletHost servletHost = registry.getExtensionPoint(ServletHost.class);
+ Axis2BindingProviderFactory providerFactory = new Axis2BindingProviderFactory(servletHost, messageFactory);
+ providerFactories.addProviderFactory(providerFactory);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2OneWayBindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2OneWayBindingInvoker.java
new file mode 100644
index 0000000000..fb95022c6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2OneWayBindingInvoker.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+
+public class Axis2OneWayBindingInvoker extends Axis2BindingInvoker {
+
+ public Axis2OneWayBindingInvoker(ServiceClient serviceClient,
+ QName wsdlOperationName,
+ Options options,
+ SOAPFactory soapFactory) {
+
+ super(serviceClient, wsdlOperationName, options, soapFactory);
+ }
+
+ protected Object invokeTarget(final Object payload, final short sequence, String conversationId) throws InvocationTargetException {
+ try {
+ Object[] args = (Object[]) payload;
+
+ OperationClient operationClient = createOperationClient(args, conversationId);
+ operationClient.execute(false);
+
+ // REVIEW it seems ok to return null
+ return null;
+
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ } catch (Throwable t) {
+ throw new InvocationTargetException(t);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
new file mode 100644
index 0000000000..98994aa917
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceBindingProvider.java
@@ -0,0 +1,267 @@
+/**
+ *
+ * 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.sca.binding.axis2;
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private MessageFactory messageFactory;
+ private RuntimeComponent component;
+ private RuntimeComponentReference reference;
+ private WebServiceBinding wsBinding;
+ private ConfigurationContext configContext;
+ private ServiceClient serviceClient;
+
+ public Axis2ReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ WebServiceBinding wsBinding,
+ MessageFactory messageFactory) {
+
+ this.component = component;
+ this.reference = reference;
+ this.wsBinding = wsBinding;
+ this.messageFactory = messageFactory;
+
+ try {
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ configContext = tuscanyAxisConfigurator.getConfigurationContext();
+ } catch (AxisFault e) {
+ throw new RuntimeException(e); // TODO: better exception
+ }
+ initServiceClient();
+ }
+
+ // methods for ReferenceBindingActivator
+
+ public void initServiceClient() {
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = reference.getInterfaceContract();
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().setDefaultDataBinding(OMElement.class.getName());
+
+ // ??? following line was in Axis2BindingBuilder before the SPI changes
+ // and code reorg
+ //
+ // URI targetURI = wsBinding.getURI() != null ?
+ // URI.create(wsBinding.getURI()) : URI.create("foo");
+ //
+ // targetURI was passed to the ReferenceBindingExtension constructor and
+ // apparently was unused
+ // Do we still need a targetURI?
+
+ // wsBinding.setURI(component.getURI() + "#" + reference.getName());
+
+ // create an Axis2 ServiceClient
+ serviceClient = createServiceClient();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+
+ // close all connections that we have initiated, so that the jetty
+ // server
+ // can be restarted without seeing ConnectExceptions
+ HttpClient httpClient = (HttpClient)serviceClient.getServiceContext().getConfigurationContext()
+ .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
+ if (httpClient != null)
+ ((MultiThreadedHttpConnectionManager)httpClient.getHttpConnectionManager()).shutdown();
+ }
+
+ /**
+ * Create an Axis2 ServiceClient
+ */
+ protected ServiceClient createServiceClient() {
+ try {
+ QName serviceQName = wsBinding.getServiceName();
+ String portName = wsBinding.getPortName();
+ Definition wsdlDefinition = wsBinding.getWSDLDefinition().getDefinition();
+ AxisService axisService = AxisService.createClientSideAxisService(wsdlDefinition,
+ serviceQName,
+ portName,
+ new Options());
+
+ return new ServiceClient(configContext, axisService);
+ } catch (AxisFault e) {
+ throw new RuntimeException(e); // TODO: better exception
+ }
+ }
+
+ // methods for ReferenceBindingProvider
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return wsBinding.getBindingInterfaceContract();
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+
+ Axis2BindingInvoker invoker;
+
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = reference.getInterfaceContract();
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ if (wsBinding.getBindingInterfaceContract().getCallbackInterface() == null) {
+ invoker = createOperationInvoker(serviceClient, operation, false, operation.isNonBlocking());
+ } else {
+ // FIXME: SDODataBinding needs to pass in TypeHelper and classLoader
+ // as parameters.
+
+ // FIXME: This makes the (BIG) assumption that there is only one
+ // callback method
+ // Relaxing this assumption, however, does not seem to be trivial,
+ // it may depend on knowledge
+ // of what actual callback method was invoked by the service at the
+ // other end
+
+ RuntimeWire wire = reference.getRuntimeWire(wsBinding);
+ Operation callbackOperation = findCallbackOperation(wire);
+ Axis2CallbackInvocationHandler invocationHandler = new Axis2CallbackInvocationHandler(messageFactory, wire);
+ Axis2ReferenceCallbackTargetInvoker callbackInvoker = new Axis2ReferenceCallbackTargetInvoker(
+ callbackOperation,
+ wire,
+ invocationHandler);
+
+ Axis2AsyncBindingInvoker asyncInvoker = (Axis2AsyncBindingInvoker)createOperationInvoker(serviceClient,
+ operation,
+ true,
+ false);
+ asyncInvoker.setCallbackTargetInvoker(callbackInvoker);
+ invoker = asyncInvoker;
+ }
+
+ return invoker;
+ }
+
+ private Operation findCallbackOperation(RuntimeWire wire) {
+ InterfaceContract contract = wire.getTarget().getInterfaceContract(); // TODO:
+ // which
+ // end?
+ List callbackOperations = contract.getCallbackInterface().getOperations();
+ if (callbackOperations.size() != 1) {
+ throw new RuntimeException("Can only handle one callback operation");
+ }
+ Operation callbackOperation = (Operation)callbackOperations.get(0);
+ return callbackOperation;
+ }
+
+ /**
+ * Create and configure an Axis2BindingInvoker for each operation
+ */
+ private Axis2BindingInvoker createOperationInvoker(ServiceClient serviceClient,
+ Operation operation,
+ boolean hasCallback,
+ boolean isOneWay) {
+
+ Options options = new Options();
+ options.setTo(getPortLocationEPR());
+ options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
+
+ String operationName = operation.getName();
+
+ String soapAction = getSOAPAction(operationName);
+ if (soapAction != null && soapAction.length() > 1) {
+ options.setAction(soapAction);
+ }
+
+ options.setTimeOutInMilliSeconds(30 * 1000); // 30 seconds
+
+ SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
+ QName wsdlOperationQName = new QName(operationName);
+
+ Axis2BindingInvoker invoker;
+ if (hasCallback) {
+ invoker = new Axis2AsyncBindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
+ } else if (isOneWay) {
+ invoker = new Axis2OneWayBindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
+ } else {
+ invoker = new Axis2BindingInvoker(serviceClient, wsdlOperationQName, options, soapFactory);
+ }
+
+ return invoker;
+ }
+
+ protected EndpointReference getPortLocationEPR() {
+ String ep = wsBinding.getURI();
+ if (ep == null && wsBinding.getPort() != null) {
+ List wsdlPortExtensions = wsBinding.getPort().getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ ep = ((SOAPAddress)extension).getLocationURI();
+ break;
+ }
+ }
+ }
+ return new EndpointReference(ep);
+ }
+
+ protected String getSOAPAction(String operationName) {
+ Binding binding = wsBinding.getBinding();
+ if (binding != null) {
+ for (Object o : binding.getBindingOperations()) {
+ BindingOperation bop = (BindingOperation)o;
+ if (bop.getName().equalsIgnoreCase(operationName)) {
+ for (Object o2 : bop.getExtensibilityElements()) {
+ if (o2 instanceof SOAPOperation) {
+ return ((SOAPOperation)o2).getSoapActionURI();
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallback.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallback.java
new file mode 100644
index 0000000000..cbc82f9c68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallback.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.client.async.AsyncResult;
+import org.apache.axis2.client.async.Callback;
+import org.apache.axis2.context.MessageContext;
+
+public class Axis2ReferenceCallback extends Callback {
+
+ private Axis2ReferenceCallbackTargetInvoker targetInvoker;
+
+ public Axis2ReferenceCallback(Axis2ReferenceCallbackTargetInvoker targetInvoker) {
+ this.targetInvoker = targetInvoker;
+ }
+
+ public void onComplete(AsyncResult result) {
+ MessageContext responseMC = result.getResponseMessageContext();
+ OMElement responseOM = responseMC.getEnvelope().getBody().getFirstElement();
+ try {
+ targetInvoker.invokeTarget(new Object[] {responseOM}, null);
+ } catch (InvocationTargetException e) {
+ // FIXME what is the appropriate exception here?
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setComplete(boolean complete) {
+ super.setComplete(complete);
+ }
+
+ public void onError(Exception e) {
+ throw new RuntimeException(e);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallbackTargetInvoker.java
new file mode 100644
index 0000000000..dce9bf8cf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceCallbackTargetInvoker.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.sca.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class Axis2ReferenceCallbackTargetInvoker {
+
+ private Operation operation;
+ private RuntimeWire inboundWire;
+ private boolean cacheable;
+ Axis2CallbackInvocationHandler invocationHandler;
+ private CountDownLatch signal;
+ private Object returnPayload;
+
+ public Axis2ReferenceCallbackTargetInvoker(Operation operation,
+ RuntimeWire inboundWire,
+ Axis2CallbackInvocationHandler invocationHandler) {
+
+ this.operation = operation;
+ this.inboundWire = inboundWire;
+ this.invocationHandler = invocationHandler;
+ }
+
+ public Object invokeTarget(final Object payload, final ConversationSequence sequence) throws InvocationTargetException {
+ Object[] args;
+ if (payload != null && !payload.getClass().isArray()) {
+ args = new Object[]{payload};
+ returnPayload = payload;
+ } else {
+ args = (Object[]) payload;
+ returnPayload = args[0];
+ }
+ // FIXME synchronize with forward thread to return value
+ signal.countDown();
+ try {
+// return invocationHandler.invoke(operation, args, callbackRoutingChain);
+ return null; // TODO ???
+ } catch (Throwable t) {
+ t.printStackTrace();
+ throw new InvocationTargetException(t);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = invokeTarget(msg.getBody(), null);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public boolean isOptimizable() {
+ return isCacheable(); // we only need to check if the scopes are correct
+ }
+
+ public Axis2ReferenceCallbackTargetInvoker clone() throws CloneNotSupportedException {
+ Axis2ReferenceCallbackTargetInvoker invoker = (Axis2ReferenceCallbackTargetInvoker) super.clone();
+ invoker.operation = this.operation;
+ invoker.inboundWire = this.inboundWire;
+ invoker.cacheable = this.cacheable;
+ invoker.invocationHandler = this.invocationHandler;
+ return invoker;
+ }
+
+ public void setSignal(CountDownLatch signal) {
+ this.signal = signal;
+ }
+
+ public Object getReturnPayload() {
+ return returnPayload;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
new file mode 100644
index 0000000000..f843cb07a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceBindingProvider.java
@@ -0,0 +1,418 @@
+/**
+ *
+ * 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.sca.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.description.WSDLToAxisServiceBuilder;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private WebServiceBinding wsBinding;
+ private ServletHost servletHost;
+ private ConfigurationContext configContext;
+ private MessageFactory messageFactory;
+
+ // TODO: what to do about the base URI?
+ private static final String BASE_URI = "http://localhost:8080/";
+
+ public Axis2ServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ WebServiceBinding wsBinding,
+ ServletHost servletHost,
+ MessageFactory messageFactory) {
+
+ this.component = component;
+ this.service = service;
+ this.wsBinding = wsBinding;
+ this.servletHost = servletHost;
+ this.messageFactory = messageFactory;
+
+ try {
+ TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+ configContext = tuscanyAxisConfigurator.getConfigurationContext();
+ } catch (AxisFault e) {
+ throw new RuntimeException(e); // TODO: better exception
+ }
+ }
+
+ // methods for ServiceBindingActivator
+
+ public void start() {
+
+ // TODO: add back in from duplicate code in getBindingInterfaceContract
+ // to temporarily bypass NPE
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = service.getInterfaceContract();
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().setDefaultDataBinding(OMElement.class.getName());
+
+ String uri = computeActualURI(BASE_URI, component, service).normalize().toString();
+ if (uri.endsWith("/")) {
+ uri = uri.substring(0, uri.length() - 1);
+ }
+ wsBinding.setURI(uri.toString());
+
+ // TODO: if <binding.ws> specifies the wsdl service then should create a
+ // service for every port
+
+ try {
+ configContext.getAxisConfiguration().addService(createAxisService());
+ } catch (AxisFault e) {
+ throw new RuntimeException(e);
+ }
+
+ Axis2ServiceServlet servlet = new Axis2ServiceServlet();
+ servlet.init(configContext);
+ String servletURI = wsBinding.getURI();
+ configContext.setContextRoot(servletURI);
+ servletHost.addServletMapping(servletURI, servlet);
+ }
+
+ public void stop() {
+ servletHost.removeServletMapping(wsBinding.getURI());
+ try {
+ configContext.getAxisConfiguration().removeService(wsBinding.getURI());
+ } catch (AxisFault e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Compute the endpoint URI based on section 2.1.1 of the WS binding spec 1.
+ * The URIs in the endpoint(s) of the referenced WSDL, which may be relative
+ * 2. The URI specified by the wsa:Address element of the
+ * wsa:EndpointReference, which may be relative 3. The explicitly stated URI
+ * in the "uri" attribute of the binding.ws element, which may be relative,
+ * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly spec
+ * If the <binding.ws> has no wsdlElement but does have a uri attribute then
+ * the uri takes precidence over any implicitly used WSDL.
+ *
+ * @param parent
+ */
+ protected URI computeActualURI(String baseURI, RuntimeComponent component, RuntimeComponentService service) {
+
+ // TODO: support wsa:Address
+
+ URI wsdlURI = null;
+ if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
+ // <binding.ws> explicitly points at a wsdl port, may be a relative
+ // URI
+ wsdlURI = getEndpoint(wsBinding.getPort());
+ }
+ if (wsdlURI != null && wsdlURI.isAbsolute()) {
+ if (wsBinding.getURI() != null && (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null)) {
+ throw new IllegalArgumentException("binding URI cannot be used with absolute WSDL endpoint URI");
+ }
+ return URI.create(wsdlURI.toString());
+ }
+
+ // either there is no wsdl port endpoint URI or that URI is relative
+
+ URI bindingURI = null;
+ if (wsBinding.getURI() != null) {
+ bindingURI = URI.create(wsBinding.getURI());
+ }
+ if (bindingURI != null && bindingURI.isAbsolute()) {
+ // there is an absoulte uri specified on the binding: <binding.ws
+ // uri="xxx"
+ if (wsdlURI != null) {
+ // there is a relative URI in the wsdl port
+ return URI.create(bindingURI + "/" + wsdlURI);
+ } else {
+ return bindingURI;
+ }
+ }
+
+ // both the WSDL endpoint and binding uri are either unspecified or
+ // relative so
+ // the endpoint is based on the component name and service binding URI
+
+ URI componentURI = URI.create(component.getName());
+
+ String actualURI;
+ if (componentURI.isAbsolute()) {
+ actualURI = componentURI.toString();
+ } else {
+ actualURI = baseURI + "/" + componentURI;
+ }
+
+ // with multiple services the default binding URI is the binding name
+ if (bindingURI == null && component.getServices().size() > 1) {
+ // if the binding doesn't have a name use the name of the service
+ // (assumption, not in spec)
+ if (wsBinding.getName() != null) {
+ bindingURI = URI.create(wsBinding.getName());
+ } else {
+ bindingURI = URI.create(service.getName());
+ }
+ }
+
+ // add any relative binding URI
+ if (bindingURI != null) {
+ actualURI += "/" + bindingURI;
+ }
+
+ // add any relative WSDL port URI
+ if (wsdlURI != null) {
+ actualURI += "/" + wsdlURI.toString();
+ }
+
+ return URI.create(actualURI);
+ }
+
+ /**
+ * Returns the endpoint of a given port.
+ */
+ protected URI getEndpoint(Port wsdlPort) {
+ if (wsdlPort != null) {
+ List wsdlPortExtensions = wsdlPort.getExtensibilityElements();
+ for (Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return URI.create(((SOAPAddress)extension).getLocationURI());
+ }
+ }
+ }
+ return null;
+ }
+
+ private AxisService createAxisService() throws AxisFault {
+ Definition definition = wsBinding.getWSDLDefinition().getDefinition();
+
+ // WSDLToAxisServiceBuilder only uses the service and port to find the
+ // wsdl4J Binding
+ // An SCA service with binding.ws does not require a service or port so
+ // we may not have these
+ // but
+
+ WSDLToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, wsBinding.getServiceName(),
+ wsBinding.getPortName());
+ builder.setServerSide(true);
+ AxisService axisService = builder.populateService();
+
+ String path = URI.create(wsBinding.getURI()).getPath();
+ axisService.setName(path);
+ axisService.setServiceDescription("Tuscany configured AxisService for service: " + wsBinding.getURI());
+
+ // Use the existing WSDL
+ Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
+ wsdlParam.setValue(definition);
+ axisService.addParameter(wsdlParam);
+ Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
+ axisService.addParameter(userWSDL);
+
+ for (Iterator i = axisService.getOperations(); i.hasNext();) {
+ AxisOperation axisOp = (AxisOperation)i.next();
+ Operation op = getOperation(axisOp);
+ if (op != null) {
+
+ if (op.isNonBlocking()) {
+ axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
+ } else {
+ axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
+ }
+
+ MessageReceiver msgrec = null;
+ if (wsBinding.getBindingInterfaceContract().getCallbackInterface() != null) {
+ msgrec = new Axis2ServiceInOutAsyncMessageReceiver(this, op);
+ } else if (op.isNonBlocking()) {
+ msgrec = new Axis2ServiceInMessageReceiver(this, op);
+ } else {
+ msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op);
+ }
+ axisOp.setMessageReceiver(msgrec);
+ }
+ }
+
+ return axisService;
+ }
+
+ protected Operation getOperation(AxisOperation axisOp) {
+ String operationName = axisOp.getName().getLocalPart();
+ for (Operation op : wsBinding.getBindingInterfaceContract().getInterface().getOperations()) {
+ if (op.getName().equalsIgnoreCase(operationName)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ // methods for ServiceBindingProvider
+
+ public InterfaceContract getBindingInterfaceContract() {
+ InterfaceContract contract = wsBinding.getBindingInterfaceContract();
+ if (contract == null) {
+ contract = service.getInterfaceContract();
+ wsBinding.setBindingInterfaceContract(contract);
+ }
+
+ // Set to use the Axiom data binding
+ contract.getInterface().setDefaultDataBinding(OMElement.class.getName());
+ return contract;
+ }
+
+ // other methods that were previously in Axis2ServiceBinding
+ // TODO: are these still needed?
+
+ private Map<Object, InvocationContext> invCtxMap = new HashMap<Object, InvocationContext>();
+
+ public Invoker createTargetInvoker(InterfaceContract contract, Operation operation) {
+ // if (!operation.isCallback()) { TODO: no isCallback methjod yet?
+ // throw new UnsupportedOperationException();
+ // } else {
+ return new Axis2ServiceCallbackTargetInvoker(this);
+ // }
+ }
+
+ public void addMapping(Object msgId, InvocationContext invCtx) {
+ this.invCtxMap.put(msgId, invCtx);
+ }
+
+ public InvocationContext retrieveMapping(Object msgId) {
+ return this.invCtxMap.get(msgId);
+ }
+
+ public void removeMapping(Object msgId) {
+ this.invCtxMap.remove(msgId);
+ }
+
+ /**
+ * @param inMC
+ * @return
+ */
+ protected static String getConversationID(MessageContext inMC) {
+ String conversationID = null;
+ Iterator i = inMC.getEnvelope().getHeader()
+ .getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing", "From"));
+ for (; i.hasNext();) {
+ Object a = i.next();
+ if (a instanceof OMElement) {
+ OMElement ao = (OMElement)a;
+ for (Iterator rpI = ao.getChildrenWithName(new QName("http://www.w3.org/2005/08/addressing",
+ "ReferenceParameters")); rpI.hasNext();) {
+ OMElement rpE = (OMElement)rpI.next();
+ for (Iterator cidI = rpE.getChildrenWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN); cidI
+ .hasNext();) {
+ OMElement cidE = (OMElement)cidI.next();
+ conversationID = cidE.getText();
+ }
+ }
+
+ }
+
+ }
+ return conversationID;
+ }
+
+ public Object invokeTarget(Operation op, Object[] args, Object messageId, String conversationID)
+ throws InvocationTargetException {
+
+ Message requestMsg = messageFactory.createMessage();
+
+ if (messageId != null) {
+ requestMsg.setMessageID(messageId);
+ }
+ requestMsg.setBody(args);
+
+ Message workContext = ThreadMessageContext.getMessageContext();
+
+ ThreadMessageContext.setMessageContext(requestMsg);
+ try {
+ if (isConversational() && conversationID != null) {
+ requestMsg.setConversationID(conversationID);
+ } else {
+ requestMsg.setConversationID(null);
+ }
+
+ Message responseMsg = service.getInvoker(wsBinding, op).invoke(requestMsg);
+
+ if (responseMsg.isFault()) {
+ throw new InvocationTargetException((Throwable)responseMsg.getBody());
+ }
+ return responseMsg.getBody();
+
+ } finally {
+ ThreadMessageContext.setMessageContext(workContext);
+ }
+ }
+
+ protected class InvocationContext {
+ public MessageContext inMessageContext;
+
+ public Operation operation;
+
+ public SOAPFactory soapFactory;
+
+ public CountDownLatch doneSignal;
+
+ public InvocationContext(MessageContext messageCtx,
+ Operation operation,
+ SOAPFactory soapFactory,
+ CountDownLatch doneSignal) {
+ this.inMessageContext = messageCtx;
+ this.operation = operation;
+ this.soapFactory = soapFactory;
+ this.doneSignal = doneSignal;
+ }
+ }
+
+ public boolean isConversational() {
+ return wsBinding.getBindingInterfaceContract().getInterface().isConversational();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceCallbackTargetInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceCallbackTargetInvoker.java
new file mode 100644
index 0000000000..29eb24bc61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceCallbackTargetInvoker.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.util.Utils;
+import org.apache.tuscany.sca.binding.axis2.Axis2ServiceBindingProvider.InvocationContext;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+public class Axis2ServiceCallbackTargetInvoker implements Invoker {
+
+ private Axis2ServiceBindingProvider service;
+
+ protected static final OMElement RESPONSE = null;
+
+ public Axis2ServiceCallbackTargetInvoker(Axis2ServiceBindingProvider service) {
+ this.service = service;
+ }
+
+ private Object invokeTarget(final Object payload, Object correlationId) throws InvocationTargetException {
+ try {
+ // Use current correlation id as index to retrieve inv context
+ InvocationContext invCtx = service.retrieveMapping(correlationId);
+
+ MessageContext outMC = Utils.createOutMessageContext(invCtx.inMessageContext);
+ outMC.getOperationContext().addMessageContext(outMC);
+
+ OMElement responseOM;
+ if (payload != null && !payload.getClass().isArray()) {
+ responseOM = (OMElement) payload;
+ } else {
+ responseOM = (OMElement) ((Object[]) payload)[0];
+ }
+ SOAPEnvelope soapEnvelope = invCtx.soapFactory.getDefaultEnvelope();
+ soapEnvelope.getBody().addChild(responseOM);
+ outMC.setEnvelope(soapEnvelope);
+ outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+
+ AxisEngine engine =
+ new AxisEngine(
+ invCtx.inMessageContext.getOperationContext().getServiceContext().getConfigurationContext());
+ engine.send(outMC);
+
+ invCtx.doneSignal.countDown();
+
+ service.removeMapping(correlationId);
+ } catch (AxisFault e) {
+ throw new InvocationTargetException(e);
+ } catch (Throwable t) {
+ throw new InvocationTargetException(t);
+ }
+
+ return RESPONSE;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object correlationId = msg.getCorrelationID();
+ if (correlationId == null) {
+ throw new RuntimeException("Missing correlation id");
+ }
+ Object resp = invokeTarget(msg.getBody(), correlationId);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public Axis2ServiceCallbackTargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ return (Axis2ServiceCallbackTargetInvoker) super.clone();
+ } catch (CloneNotSupportedException e) {
+ // will not happen
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInMessageReceiver.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInMessageReceiver.java
new file mode 100644
index 0000000000..85871c7924
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInMessageReceiver.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.sca.binding.axis2;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractInMessageReceiver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
+
+ protected Operation operation;
+
+ private Axis2ServiceBindingProvider provider;
+
+ public Axis2ServiceInMessageReceiver(Axis2ServiceBindingProvider provider, Operation operation) {
+ this.provider = provider;
+ this.operation = operation;
+ }
+
+ public Axis2ServiceInMessageReceiver() {
+
+ }
+
+ @Override
+ public void invokeBusinessLogic(MessageContext inMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+ String conversationID = provider.isConversational() ? Axis2ServiceBindingProvider.getConversationID(inMC) : null;
+
+// axis2Service.invokeTarget(operation, args, null, conversationID);
+
+// } catch (InvocationTargetException e) {
+// Throwable t = e.getCause();
+// if (t instanceof Exception) {
+// throw AxisFault.makeFault((Exception)t);
+// }
+// throw new InvocationRuntimeException(e);
+ } catch (Throwable t) {
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new RuntimeException(t);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.java
new file mode 100644
index 0000000000..70d705c7b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutAsyncMessageReceiver.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.sca.binding.axis2;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+public class Axis2ServiceInOutAsyncMessageReceiver extends AbstractMessageReceiver {
+
+ private Operation operation;
+
+ private Axis2ServiceBindingProvider provider;
+
+ public Axis2ServiceInOutAsyncMessageReceiver(Axis2ServiceBindingProvider provider,
+ Operation operation) {
+ this.provider = provider;
+ this.operation = operation;
+ }
+
+ public Axis2ServiceInOutAsyncMessageReceiver() {
+ }
+
+ public final void receive(final MessageContext messageCtx) {
+ try {
+ Object messageId = messageCtx.getMessageID();
+ if (messageId == null) {
+ messageId = new MessageId();
+ }
+
+ // Now use message id as index to context to be used by callback
+ // target invoker
+ CountDownLatch doneSignal = new CountDownLatch(1);
+// InvocationContext invCtx =
+// service.new InvocationContext(messageCtx, operation, getSOAPFactory(messageCtx), doneSignal);
+// service.addMapping(messageId, invCtx);
+
+ invokeBusinessLogic(messageCtx, messageId);
+
+ try {
+ doneSignal.await();
+ } catch(InterruptedException e) {
+ e.printStackTrace();
+ }
+ } catch (AxisFault e) {
+ // log.error(e);
+ }
+ }
+
+ private void invokeBusinessLogic(MessageContext inMC, Object messageId) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+ String conversationID = provider.isConversational() ? Axis2ServiceBindingProvider.getConversationID(inMC) : null;
+// service.invokeTarget(operation, args, messageId, conversationID);
+// } catch (InvocationTargetException e) {
+// Throwable t = e.getCause();
+// if (t instanceof Exception) {
+// throw AxisFault.makeFault((Exception)t);
+// }
+// throw new InvocationRuntimeException(e);
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+
+ /**
+ * A unique identifier for a message flowing on a wire, potentially end-to-end (ie, through more than one SCAObject to
+ * SCAObject hop).
+ *
+ * This used to be in the org.apache.tuscany.spi.wire package
+ */
+ public class MessageId {
+
+ private long timestamp;
+
+ public MessageId() {
+ this.timestamp = System.currentTimeMillis();
+ }
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public String toString() {
+ return "MsgId[" + timestamp + "]";
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final MessageId messageId = (MessageId) o;
+ return timestamp == messageId.timestamp;
+ }
+
+ public int hashCode() {
+ return (int) (timestamp ^ (timestamp >>> 32));
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.java
new file mode 100644
index 0000000000..ea5bb9f2e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceInOutSyncMessageReceiver.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.binding.axis2;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
+
+ protected Operation operation;
+
+ private Axis2ServiceBindingProvider provider;
+
+ public Axis2ServiceInOutSyncMessageReceiver() {
+ }
+
+ public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceBindingProvider provider, Operation operation) {
+ this.provider = provider;
+ this.operation = operation;
+ }
+
+ @Override
+ public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault {
+ try {
+ OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
+ Object[] args = new Object[] {requestOM};
+
+ String conversationID = provider.isConversational() ? Axis2ServiceBindingProvider.getConversationID(inMC) : null;
+
+ OMElement responseOM = (OMElement) provider.invokeTarget(operation, args, null, conversationID);
+
+ SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
+ if(null != responseOM ){
+ soapEnvelope.getBody().addChild(responseOM);
+ }
+ outMC.setEnvelope(soapEnvelope);
+ outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
+
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ Throwable t = e.getCause();
+ if (t instanceof Exception) {
+ throw AxisFault.makeFault((Exception)t);
+ }
+ throw new RuntimeException(e);
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
new file mode 100644
index 0000000000..b313ff1b4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceServlet.java
@@ -0,0 +1,300 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.axis2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.SocketException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.transport.http.AxisServlet;
+import org.apache.axis2.transport.http.ListingAgent;
+import org.apache.axis2.transport.http.server.HttpUtils;
+
+/**
+ * This overrides the servlet init of the AxisServlet so Tuscany can use
+ * a single Axis2 ConfigurationContext instance shared between AxisServlet
+ * instances for each SCA service with a ws binding.
+ * TODO: need to review if thats really what we want to be doing
+ */
+public class Axis2ServiceServlet extends AxisServlet {
+
+ protected TuscanyListingAgent agent;
+ protected boolean inited;
+
+ private static final long serialVersionUID = 1L;
+ private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig();
+
+ public void init(ConfigurationContext configContext) {
+ this.configContext = configContext;
+ try {
+ super.init(DUMMY_CONFIG);
+ } catch (ServletException e) {
+ throw new RuntimeException(e);
+ }
+ agent = new TuscanyListingAgent(configContext);
+ }
+
+ /**
+ * Override Axis2 servlet method to avoid loop when init
+ * is called after servletConfig already initialized by
+ * this classes init(ConfigurationContext) method.
+ */
+ @Override
+ public void init() throws ServletException {
+ }
+
+ /**
+ * We've setup the Servlet by passing in a ConfigurationContext on our init method
+ * override this method to just return that
+ */
+ @Override
+ protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException {
+ return this.configContext;
+ }
+
+ @Override
+ public ServletConfig getServletConfig() {
+ return DUMMY_CONFIG;
+ }
+
+ @Override
+ public String getServletName() {
+ return "TuscanyAxis2Servlet";
+ }
+
+ /**
+ * The AxisServlet gets NPE during init without a ServletConfig so this is a mocked up one to prevent that.
+ */
+ private static ServletConfig createDummyServletConfig() {
+ ServletConfig sc = new ServletConfig() {
+
+ public String getServletName() {
+ return "TuscanyAxis2DummyServlet";
+ }
+
+ public ServletContext getServletContext() {
+ return new ServletContext() {
+
+ public ServletContext getContext(String uripath) {
+ return null;
+ }
+
+ public String getContextPath() {
+ return null;
+ }
+
+ public int getMajorVersion() {
+ return 0;
+ }
+
+ public int getMinorVersion() {
+ return 0;
+ }
+
+ public String getMimeType(String file) {
+ return null;
+ }
+
+ public Set getResourcePaths(String path) {
+ return Collections.emptySet();
+ }
+
+ public URL getResource(String path) throws MalformedURLException {
+ if("/".equals(path)) {
+ // HACK: To avoid NPE
+ return new URL("/axis2");
+ }
+ return null;
+ }
+
+ public InputStream getResourceAsStream(String path) {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return null;
+ }
+
+ public RequestDispatcher getNamedDispatcher(String arg0) {
+ return null;
+ }
+
+ public Servlet getServlet(String arg0) throws ServletException {
+ return null;
+ }
+
+ public Enumeration getServlets() {
+ return null;
+ }
+
+ public Enumeration getServletNames() {
+ return null;
+ }
+
+ public void log(String arg0) {
+ }
+
+ public void log(Exception arg0, String arg1) {
+ }
+
+ public void log(String arg0, Throwable arg1) {
+ }
+
+ public String getRealPath(String arg0) {
+ return null;
+ }
+
+ public String getServerInfo() {
+ return null;
+ }
+
+ public String getInitParameter(String arg0) {
+ return null;
+ }
+
+ public Enumeration getInitParameterNames() {
+ return null;
+ }
+
+ public Object getAttribute(String arg0) {
+ return null;
+ }
+
+ public Enumeration getAttributeNames() {
+ return null;
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ }
+
+ public void removeAttribute(String arg0) {
+ }
+
+ public String getServletContextName() {
+ return null;
+ }
+ };
+ }
+
+ public String getInitParameter(String arg0) {
+ return null;
+ }
+
+ public Enumeration getInitParameterNames() {
+ return new Vector().elements();
+ }
+ };
+ return sc;
+ }
+
+ @Override
+ protected void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ // HACK: Get the correct context root which is not available during init() call
+ if (!inited) {
+ synchronized (configContext) {
+ configContext.setContextRoot(request.getContextPath());
+ inited = true;
+ }
+ }
+
+ super.service(request, response);
+ }
+
+ @Override
+ public void destroy() {
+ try {
+ super.destroy();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Override the AxisServlet doGet to use the TuscanyListingAgent for ?wsdl
+ */
+ @Override
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+
+ initContextRoot(request);
+
+ String query = request.getQueryString();
+ if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
+ query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
+ query.indexOf("policy") >= 0)) {
+ agent.processListService(request, response);
+ } else {
+ super.doGet(request, response);
+ }
+ }
+
+ /**
+
+ /**
+ * Override the AxisServlet method so as to not add "/services" into the url
+ */
+ @Override
+ public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
+ //RUNNING_PORT
+ String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
+ if (port == null) {
+ port = "8080";
+ }
+ if (ip == null) {
+ try {
+ ip = HttpUtils.getIpAddress();
+ if (ip == null) {
+ ip = "localhost";
+ }
+ } catch (SocketException e) {
+ throw new AxisFault(e);
+ }
+ }
+
+
+ StringBuilder eprString = new StringBuilder("http://");
+ eprString.append(ip).append(":").append(port);
+ if (!serviceName.startsWith("/")) {
+ eprString.append('/');
+ }
+ eprString.append(serviceName);
+ EndpointReference endpoint = new EndpointReference(eprString.toString());
+
+ return new EndpointReference[]{endpoint};
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyAxisConfigurator.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyAxisConfigurator.java
new file mode 100755
index 0000000000..370ed6e0a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyAxisConfigurator.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.sca.binding.axis2;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.URLBasedAxisConfigurator;
+import org.apache.axis2.engine.AxisConfigurator;
+
+/**
+ * Helps configure Axis2 from a resource in binding.axis2 instead of Axis2.xml
+ * <p/> TODO: Review: should there be a single global Axis
+ * ConfigurationContext
+ */
+public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator {
+
+ public TuscanyAxisConfigurator() throws AxisFault {
+ super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/axis2/engine/config/axis2.xml"), null);
+ }
+
+ public ConfigurationContext getConfigurationContext() throws AxisFault {
+ if (configContext == null)
+ configContext = ConfigurationContextFactory.createConfigurationContext(this);
+ return configContext;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyDispatcher.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyDispatcher.java
new file mode 100644
index 0000000000..8988c74445
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyDispatcher.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.sca.binding.axis2;
+
+import java.net.URI;
+import java.util.HashMap;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.HandlerDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.RequestURIBasedDispatcher;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Tuscany specific Axis2 Dispatcher that enables using services
+ * exposed at the SCA defined service URI instead of /services/<serviceName>
+ */
+public class TuscanyDispatcher extends RequestURIBasedDispatcher {
+
+ public static final String NAME = "TuscanyDispatcher";
+ private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class);
+ private static final boolean isDebugEnabled = log.isDebugEnabled();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
+ */
+ public AxisService findService(MessageContext messageContext) throws AxisFault {
+ EndpointReference toEPR = messageContext.getTo();
+
+ if (toEPR != null) {
+ if(isDebugEnabled){
+ log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
+ }
+
+ String path = URI.create(toEPR.getAddress()).getPath();
+
+ ConfigurationContext configurationContext = messageContext.getConfigurationContext();
+ AxisConfiguration registry = configurationContext.getAxisConfiguration();
+
+ String serviceName = findAxisServiceName(registry, path);
+ return registry.getService(serviceName);
+
+ } else {
+ if(isDebugEnabled){
+ log.debug("Attempted to check for Service using null target endpoint URI");
+ }
+ return null;
+ }
+ }
+
+ public void initDispatcher() {
+ init(new HandlerDescription(NAME));
+ }
+
+ protected String findAxisServiceName(AxisConfiguration registry, String path) {
+ HashMap services = registry.getServices();
+ if (services == null) {
+ return null;
+ }
+ String[] parts = JavaUtils.split(path, '/');
+ String serviceName = "";
+ for (int i=parts.length-1; i>=0; i--) {
+ serviceName = parts[i] + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ serviceName = "/" + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyListingAgent.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyListingAgent.java
new file mode 100644
index 0000000000..87338ceb27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/axis2/TuscanyListingAgent.java
@@ -0,0 +1,334 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.axis2;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.attachments.utils.IOUtils;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.transport.http.ListingAgent;
+import org.apache.axis2.util.ExternalPolicySerializer;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyRegistry;
+import org.apache.ws.commons.schema.XmlSchema;
+
+/**
+ * A Tuscany specific Axis2 ListingAgent as the Axis2 one does not work
+ * with the Tuscany sevice names which include slash ('/') characters.
+ * Unfortunately it ends up having to copy a fair amount of Axis2 code to do this.
+ */
+public class TuscanyListingAgent extends ListingAgent {
+
+ private static final String LIST_SINGLE_SERVICE_JSP_NAME =
+ "listSingleService.jsp";
+
+ public TuscanyListingAgent(ConfigurationContext aConfigContext) {
+ super(aConfigContext);
+ }
+
+ protected String findAxisServiceName(String path) {
+ HashMap services = configContext.getAxisConfiguration().getServices();
+ if (services == null) {
+ return null;
+ }
+ String[] parts = JavaUtils.split(path, '/');
+ String serviceName = "";
+ for (int i=parts.length-1; i>=0; i--) {
+ serviceName = parts[i] + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ serviceName = "/" + serviceName;
+ if (services.containsKey(serviceName)) {
+ return serviceName;
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ public void processListService(HttpServletRequest req,
+ HttpServletResponse res)
+ throws IOException, ServletException {
+
+
+ String filePart = req.getRequestURL().toString();
+// String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
+// filePart.length());
+// Change the Axis2 code so as to use the complete ServletPath as the service name
+// this line is the only change to to Axis2 code
+
+ String serviceName = findAxisServiceName(filePart);
+
+ String query = req.getQueryString();
+ int wsdl2 = query.indexOf("wsdl2");
+ int wsdl = query.indexOf("wsdl");
+ int xsd = query.indexOf("xsd");
+ int policy = query.indexOf("policy");
+
+ HashMap services = configContext.getAxisConfiguration().getServices();
+ if ((services != null) && !services.isEmpty()) {
+ Object serviceObj = services.get(serviceName);
+ if (serviceObj != null) {
+ boolean isHttp = "http".equals(req.getScheme());
+ if (wsdl2 >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ String ip = extractHostAndPort(filePart, isHttp);
+ ((AxisService) serviceObj)
+ .printWSDL2(out, ip, configContext.getServiceContextPath());
+ out.flush();
+ out.close();
+ return;
+ } else if (wsdl >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ String ip = extractHostAndPort(filePart, isHttp);
+ ((AxisService) serviceObj).printWSDL(out, ip, configContext.getServicePath());
+ out.flush();
+ out.close();
+ return;
+ } else if (xsd >= 0) {
+ OutputStream out = res.getOutputStream();
+ res.setContentType("text/xml");
+ AxisService axisService = (AxisService) serviceObj;
+ //call the populator
+ axisService.populateSchemaMappings();
+ Map schemaMappingtable =
+ axisService.getSchemaMappingTable();
+ ArrayList schemas = axisService.getSchema();
+
+ //a name is present - try to pump the requested schema
+ String xsds = req.getParameter("xsd");
+ if (!"".equals(xsds)) {
+ XmlSchema schema =
+ (XmlSchema) schemaMappingtable.get(xsds);
+ if (schema != null) {
+ //schema is there - pump it outs
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ out.close();
+ } else {
+ InputStream in = axisService.getClassLoader()
+ .getResourceAsStream(DeploymentConstants.META_INF + "/" + xsds);
+ if (in != null) {
+ out.write(IOUtils.getStreamAsByteArray(in));
+ out.flush();
+ out.close();
+ } else {
+ res.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
+ //multiple schemas are present and the user specified
+ //no name - in this case we cannot possibly pump a schema
+ //so redirect to the service root
+ } else if (schemas.size() > 1) {
+ res.sendRedirect("");
+ //user specified no name and there is only one schema
+ //so pump that out
+ } else {
+ XmlSchema schema = axisService.getSchema(0);
+ if (schema != null) {
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ out.close();
+ }
+ }
+ return;
+ } else if (policy >= 0) {
+
+ OutputStream out = res.getOutputStream();
+
+ ExternalPolicySerializer serializer = new ExternalPolicySerializer();
+ serializer.setAssertionsToFilter(configContext
+ .getAxisConfiguration().getLocalPolicyAssertions());
+
+ // check whether Id is set
+ String idParam = req.getParameter("id");
+
+ if (idParam != null) {
+ // Id is set
+
+ Policy targetPolicy = findPolicy(idParam, (AxisService) serviceObj);
+
+ if (targetPolicy != null) {
+ XMLStreamWriter writer;
+
+ try {
+ writer = XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(out);
+
+ res.setContentType("text/xml");
+ targetPolicy.serialize(writer);
+ writer.flush();
+
+ } catch (XMLStreamException e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+
+ } catch (FactoryConfigurationError e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+ }
+
+ } else {
+
+ res.setContentType("text/html");
+ String outStr = "<b>No policy found for id="
+ + idParam + "</b>";
+ out.write(outStr.getBytes());
+ }
+
+ } else {
+
+ PolicyInclude policyInclude = ((AxisService) serviceObj).getPolicyInclude();
+ Policy effecPolicy = policyInclude.getEffectivePolicy();
+
+ if (effecPolicy != null) {
+ XMLStreamWriter writer;
+
+ try {
+ writer = XMLOutputFactory.newInstance()
+ .createXMLStreamWriter(out);
+
+ res.setContentType("text/xml");
+ effecPolicy.serialize(writer);
+ writer.flush();
+
+ } catch (XMLStreamException e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+
+ } catch (FactoryConfigurationError e) {
+ throw new ServletException(
+ "Error occured when serializing the Policy",
+ e);
+ }
+ } else {
+
+ res.setContentType("text/html");
+ String outStr = "<b>No effective policy for "
+ + serviceName + " servcie</b>";
+ out.write(outStr.getBytes());
+ }
+ }
+
+ return;
+ } else {
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE,
+ serviceObj);
+ }
+ } else {
+ req.getSession().setAttribute(Constants.SINGLE_SERVICE, null);
+ }
+ }
+
+ renderView(LIST_SINGLE_SERVICE_JSP_NAME, req, res);
+ }
+
+ private String extractHostAndPort(String filePart, boolean isHttp) {
+ int ipindex = filePart.indexOf("//");
+ String ip = null;
+ if (ipindex >= 0) {
+ ip = filePart.substring(ipindex + 2, filePart.length());
+ int seperatorIndex = ip.indexOf(":");
+ int slashIndex = ip.indexOf("/");
+ String port;
+ if (seperatorIndex >= 0) {
+ port = ip.substring(seperatorIndex + 1, slashIndex);
+ ip = ip.substring(0, seperatorIndex);
+ } else {
+ ip = ip.substring(0, slashIndex);
+ port = "80";
+ }
+ if (isHttp) {
+ configContext.setProperty(RUNNING_PORT, port);
+ }
+ }
+ return ip;
+ }
+
+ private Policy findPolicy(String id, AxisDescription des) {
+
+ List policyElements = des.getPolicyInclude().getPolicyElements();
+ PolicyRegistry registry = des.getPolicyInclude().getPolicyRegistry();
+
+ Object policyComponent;
+
+ Policy policy = registry.lookup(id);
+
+ if (policy != null) {
+ return policy;
+ }
+
+ for (Iterator iterator = policyElements.iterator(); iterator.hasNext();) {
+ policyComponent = iterator.next();
+
+ if (policyComponent instanceof Policy) {
+ // policy found for the id
+
+ if (id.equals(((Policy) policyComponent).getId())) {
+ return (Policy) policyComponent;
+ }
+ }
+ }
+
+ AxisDescription child;
+
+ for (Iterator iterator = des.getChildren(); iterator.hasNext();) {
+ child = (AxisDescription) iterator.next();
+ policy = findPolicy(id, child);
+
+ if (policy != null) {
+ return policy;
+ }
+ }
+
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f3bdb2511a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.axis2.Axis2ModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/axis2/engine/config/axis2.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/axis2/engine/config/axis2.xml
new file mode 100755
index 0000000000..52a61790ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/axis2/engine/config/axis2.xml
@@ -0,0 +1,306 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<axisconfig name="AxisJava2.0">
+ <!-- ================================================= -->
+ <!-- Parameters -->
+ <!-- ================================================= -->
+ <parameter name="hotdeployment" locked="false">false</parameter>
+ <parameter name="hotupdate" locked="false">false</parameter>
+ <parameter name="enableMTOM" locked="false">false</parameter>
+ <parameter name="enableSwA" locked="false">false</parameter>
+
+ <!--Uncomment if you want to enable file caching for attachments -->
+ <!--parameter name="cacheAttachments" locked="false">true</parameter>
+ <parameter name="attachmentDIR" locked="false"></parameter>
+ <parameter name="sizeThreshold" locked="false">4000</parameter-->
+
+ <!--This will give out the timout of the configuration contexts, in seconds-->
+ <parameter name="ConfigContextTimeoutInterval" locked="false">30</parameter>
+
+ <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
+ <!--that behaviour.-->
+ <parameter name="sendStacktraceDetailsWithFaults" locked="false">true</parameter>
+
+ <!--If there aren't any information available to find out the fault reason, we set the message of the expcetion-->
+ <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
+ <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
+ <!--is set then, Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
+ <parameter name="DrillDownToRootCauseForFaultReason" locked="false">false</parameter>
+
+ <parameter name="userName" locked="false">admin</parameter>
+ <parameter name="password" locked="false">axis2</parameter>
+
+ <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
+ <!--root which can configured using the following contextRoot parameter-->
+ <!--<parameter name="contextRoot" locked="false">axis2</parameter>-->
+
+ <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distingiush those endpoints-->
+ <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
+ <!--context path to proper Axis2 servlets-->
+ <!--<parameter name="servicePath" locked="false">services</parameter>-->
+ <!--<parameter name="restPath" locked="false">rest</parameter>-->
+
+
+ <!--Set the flag to true if you want to enable transport level session mangment-->
+ <parameter name="manageTransportSession" locked="false">false</parameter>
+
+ <!--Following two parameters will be used to handle REST in Axis2. The default settings will make Axis2 to have two-->
+ <!--different endpoints, one for REST (AxisRESTServlet) one for SOAP message handling (AxisServlet). But following-->
+ <!--parameters help to tweak the message handling of two main servlets. -->
+
+ <!-- If the enableRESTInAxis2MainServlet is true, then Axis2MainServlet will handle both SOAP and REST messages -->
+ <parameter name="enableRESTInAxis2MainServlet" locked="true">true</parameter>
+
+ <!-- Following parameter will completely disable REST handling in both the servlets-->
+ <parameter name="disableREST" locked="true">false</parameter>
+
+ <!-- This will disable the separate servlet we have for REST handling. -->
+ <parameter name="disableSeparateEndpointForREST" locked="true">false</parameter>
+
+ <!-- If you have a frontend host which exposes this webservice using a different public URL -->
+ <!-- use this parameter to override autodetected url -->
+ <!--<parameter name="httpFrontendHostUrl" locked="false">https://someotherhost/context</parameter>-->
+
+
+ <!-- The way of adding listener to the system-->
+ <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
+ <!-- <parameter name="RSS_URL" locked="false">http://127.0.0.1/rss</parameter>-->
+ <!-- </listener>-->
+
+ <!-- ================================================= -->
+ <!-- Message Receivers -->
+ <!-- ================================================= -->
+ <!--This is the Deafult Message Receiver for the system , if you want to have MessageReceivers for -->
+ <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
+ <!--any operation -->
+ <!--Note : You can ovride this for particular service by adding the same element with your requirement-->
+ <messageReceivers>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
+ class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInOutAsyncMessageReceiver"/>
+ <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
+ class="org.apache.tuscany.sca.binding.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
+ </messageReceivers>
+ <!-- ================================================= -->
+ <!-- Transport Ins -->
+ <!-- ================================================= -->
+ <transportReceiver name="http"
+ class="org.apache.axis2.transport.http.SimpleHTTPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!-- Here is the complete list of supported parameters (see example settings further below):
+ port: the port to listen on (default 6060)
+ hostname: if non-null, url prefix used in reply-to endpoint references (default null)
+ originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
+ requestTimeout: value in millis of time that requests can wait for data (default 20000)
+ requestTcpNoDelay: true to maximize performance and minimize latency (default true)
+ false to minimize bandwidth consumption by combining segments
+ requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
+ requestMaxThreadPoolSize: number of threads available for request processing if queue fills us (default 150)
+ note that default queue never fills up: see HttpFactory
+ threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
+ note that no such threads can exist with default unbounded request queue
+ threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
+ -->
+ <!-- <parameter name="hostname" locked="false">http://www.myApp.com/ws</parameter> -->
+ <!-- <parameter name="originServer" locked="false">My-Server/1.1</parameter> -->
+ <!-- <parameter name="requestTimeout" locked="false">10000</parameter> -->
+ <!-- <parameter name="requestTcpNoDelay" locked="false">false</parameter> -->
+ <!-- <parameter name="requestCoreThreadPoolSize" locked="false">50</parameter> -->
+ <!-- <parameter name="RequestMaxThreadPoolSize" locked="false">100</parameter> -->
+ <!-- <parameter name="threadKeepAliveTime" locked="false">240000</parameter> -->
+ <!-- <parameter name="threadKeepAliveTimeUnit" locked="false">MILLISECONDS</parameter> -->
+ </transportReceiver>
+
+ <!--Uncomment this and configure as appropriate for JMS transport support, after setting up your JMS environment (e.g. ActiveMQ)
+ <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
+ <parameter name="myTopicConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="myQueueConnectionFactory" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+
+ <parameter name="default" locked="false">
+ <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+ <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
+ <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
+ </parameter>
+ </transportReceiver>-->
+
+ <!--Uncomment if you want to have SMTP transport support-->
+ <!--<transportReceiver name="mail" class="org.apache.axis2.transport.mail.SimpleMailListener">-->
+ <!--<parameter name="transport.mail.pop3.host" locked="false">127.0.0.1</parameter>-->
+ <!--<parameter name="transport.mail.pop3.user" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.password" locked="false">axis2</parameter>-->
+ <!--<parameter name="transport.mail.pop3.port" locked="false">110</parameter>-->
+ <!--<parameter name="transport.mail.replyToAddress" locked="false">axis2@127.0.0.1</parameter>-->
+ <!--</transportReceiver>-->
+
+ <transportReceiver name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPServer">
+ <parameter name="port" locked="false">6060</parameter>
+ <!--If you want to give your own host address for EPR generation-->
+ <!--uncommet following paramter , and set as you required.-->
+ <!--<parameter name="hostname" locked="false">tcp://myApp.com/ws</parameter>-->
+ </transportReceiver>
+
+ <!-- ================================================= -->
+ <!-- Transport Outs -->
+ <!-- ================================================= -->
+
+ <transportSender name="tcp"
+ class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
+ <transportSender name="local"
+ class="org.apache.axis2.transport.local.LocalTransportSender"/>
+ <transportSender name="http"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+ <transportSender name="https"
+ class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
+ <parameter name="PROTOCOL" locked="false">HTTP/1.1</parameter>
+ <parameter name="Transfer-Encoding" locked="false">chunked</parameter>
+ </transportSender>
+
+ <!-- Commented out by Tuscany
+ <transportSender name="jms"
+ class="org.apache.axis2.transport.jms.JMSSender"/>
+ -->
+
+ <!-- Uncomment this one with the appropriate papameters to enable the SMTP transport Receiver
+ <transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
+ <parameter name="transport.mail.smtp.host" locked="false">127.0.0.1</parameter>
+ <parameter name="transport.mail.smtp.user" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.password" locked="false">axis2</parameter>
+ <parameter name="transport.mail.smtp.port" locked="false">25</parameter>
+ </transportSender>
+ -->
+
+ <!-- ================================================= -->
+ <!-- Global Modules -->
+ <!-- ================================================= -->
+ <!-- Comment this to disable Addressing -->
+ <!-- Commented out by Tuscany
+ <module ref="addressing"/>
+ -->
+
+ <!--Configuring module , providing parameters for modules whether they refer or not-->
+ <!--<moduleConfig name="addressing">-->
+ <!--<parameter name="addressingPara" locked="false">N/A</parameter>-->
+ <!--</moduleConfig>-->
+
+ <!-- ================================================= -->
+ <!-- Phases -->
+ <!-- ================================================= -->
+ <phaseOrder type="InFlow">
+ <!-- System pre defined phases -->
+ <phase name="Transport">
+ <handler name="TuscanyDispatcher"
+ class="org.apache.tuscany.sca.binding.axis2.TuscanyDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Transport"/>
+ </handler>
+ </phase>
+ <phase name="Security"/>
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ </phase>
+ <!-- System pre defined phases -->
+ <!-- After Postdispatch phase module author or or service author can add any phase he want -->
+ <phase name="OperationInPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutPhase"/>
+ <!--system predefined phase-->
+ <!--these phase will run irrespective of the service-->
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ <phase name="Security"/>
+ </phaseOrder>
+ <phaseOrder type="InFaultFlow">
+ <phase name="PreDispatch"/>
+ <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
+ <handler name="RequestURIBasedDispatcher"
+ class="org.apache.axis2.engine.RequestURIBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPActionBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPActionBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="AddressingBasedDispatcher"
+ class="org.apache.axis2.engine.AddressingBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+
+ <handler name="SOAPMessageBodyBasedDispatcher"
+ class="org.apache.axis2.engine.SOAPMessageBodyBasedDispatcher">
+ <order phase="Dispatch"/>
+ </handler>
+ <handler name="InstanceDispatcher"
+ class="org.apache.axis2.engine.InstanceDispatcher">
+ <order phase="PostDispatch"/>
+ </handler>
+ </phase>
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationInFaultPhase"/>
+ </phaseOrder>
+ <phaseOrder type="OutFaultFlow">
+ <!-- user can add his own phases to this area -->
+ <phase name="OperationOutFaultPhase"/>
+ <phase name="PolicyDetermination"/>
+ <phase name="MessageOut"/>
+ </phaseOrder>
+</axisconfig>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceTestCase.java
new file mode 100755
index 0000000000..6b364eec68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ReferenceTestCase.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.binding.axis2;
+
+import junit.framework.TestCase;
+
+public class Axis2ReferenceTestCase extends TestCase {
+
+ public void testInvokeService() throws Exception {
+// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
+// ServiceContract contract = new JavaServiceContract();
+// Operation operation = new Operation<Type>("sayHi", null, null, null, false, null, NO_CONVERSATION);
+// TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation);
+// assertNotNull(targetInvoker);
+// assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker);
+ }
+
+ public void testAsyncTargetInvoker() throws Exception {
+// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
+// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
+// Wire inboundWire = EasyMock.createNiceMock(Wire.class);
+// JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+// contract.setCallbackName("");
+// contract.setCallbackClass(GreetingCallback.class);
+// Operation<Type> callbackOp =
+// new Operation<Type>("sayHiCallback", null, null, null, true, null, NO_CONVERSATION);
+// HashMap<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
+// callbackOps.put("sayHiCallback", callbackOp);
+// contract.setCallbackOperations(callbackOps);
+// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
+// EasyMock.replay(inboundWire);
+//
+// axis2Reference.setWire(inboundWire);
+// Operation operation = new Operation<Type>("sayHi", null, null, null, true, null, NO_CONVERSATION);
+// TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation);
+// assertNotNull(asyncTargetInvoker);
+// assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker);
+ }
+
+// @SuppressWarnings("unchecked")
+// private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception {
+// //Create WebServiceBindingDefinition
+// 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 a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
+// // TODO figure out what to do with the service contract
+// ServiceContract<?> contract = new WSDLServiceContract();
+// contract.setInterfaceClass(Greeter.class);
+// return new Axis2ReferenceBinding(URI.create(serviceName),
+// wsBinding,
+// contract,
+// null,
+// null);
+// }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceTestCase.java
new file mode 100755
index 0000000000..13ea94dd66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Axis2ServiceTestCase.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.sca.binding.axis2;
+
+import junit.framework.TestCase;
+
+public class Axis2ServiceTestCase extends TestCase {
+
+ public void testInvokeService() throws Exception {
+// TestServletHost tomcatHost = new TestServletHost();
+// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, false);
+// axis2Service.start();
+//
+// if (true) return;
+// Servlet servlet = tomcatHost.getMapping("testWebAppName/serviceBindings/testServiceName");
+// assertNotNull(servlet);
+//
+// //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet
+// //To be done:
+
+ }
+
+ public void testAsyncMessageReceiver() throws Exception {
+
+// TestServletHost tomcatHost = new TestServletHost();
+// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, true);
+// axis2Service.start();
+ }
+
+// @SuppressWarnings("unchecked")
+// private Axis2ServiceBinding createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback)
+// throws Exception {
+// //Create WebServiceBindingDefinition
+// 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 a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
+//// WireService wireService = EasyMock.createNiceMock(WireService.class);
+//// wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(Wire.class));
+//// EasyMock.expectLastCall().andReturn(null);
+//// EasyMock.replay(wireService);
+//
+// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
+// Wire inboundWire = EasyMock.createNiceMock(Wire.class);
+// JavaServiceContract contract = new JavaServiceContract(Greeter.class);
+// Map<String, Operation<Type>> opMap = new HashMap<String, Operation<Type>>();
+// for (Method m : Greeter.class.getMethods()) {
+// opMap.put(m.getName(), new Operation<Type>(m.getName(), null, null, null));
+// }
+// contract.setOperations(opMap);
+// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
+// if (callback) {
+// contract.setCallbackName("");
+// }
+// EasyMock.replay(inboundWire);
+//
+// Wire outboundWire = EasyMock.createNiceMock(Wire.class);
+// Map<Operation<?>, InvocationChain> map = new HashMap<Operation<?>, InvocationChain>();
+// EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once();
+// EasyMock.replay(outboundWire);
+//
+// TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
+// ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
+// Axis2ServiceBinding axis2Service =
+// new Axis2ServiceBinding(URI.create(serviceName),
+// contract,
+// null,
+// wsBinding,
+// tomcatHost,
+// configurationContext, null);
+// axis2Service.setWire(inboundWire);
+//// axis2Service.setOutboundWire(outboundWire);
+//
+// return axis2Service;
+// }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Greeter.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Greeter.java
new file mode 100755
index 0000000000..c604b954a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/Greeter.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.binding.axis2;
+
+public interface Greeter {
+
+ String sayHi();
+
+ String greetMe(String requestType);
+
+ void greetMeOneWay(String requestType);
+
+ void greetMeWithCallback(String requestType);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/GreetingCallback.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/GreetingCallback.java
new file mode 100644
index 0000000000..bcf9baa42d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/GreetingCallback.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.binding.axis2;
+
+public interface GreetingCallback {
+
+ void greetMeCallback(String greetMeResponse);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.java
new file mode 100644
index 0000000000..dfc78e7cd8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.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.binding.axis2.itests;
+
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorld {
+
+ public String getGreetings(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldComponent.java
new file mode 100644
index 0000000000..3978726f2a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldComponent.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.binding.axis2.itests;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldComponent implements HelloWorld {
+
+ @Reference
+ public HelloWorld helloWorldWS;
+
+ public String getGreetings(String s) {
+ return helloWorldWS.getGreetings(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldMultiService.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldMultiService.java
new file mode 100644
index 0000000000..8c1120f545
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldMultiService.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.binding.axis2.itests;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+
+public class HelloWorldMultiService implements HelloWorldOM, HelloWorldOM2 {
+
+ public OMElement getGreetings(OMElement requestOM) {
+ String name = requestOM.getFirstElement().getText();
+
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
+ OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
+ responseOM.addChild(param);
+ param.addChild(omFactory.createOMText("Hello " + name));
+
+ return responseOM;
+ }
+
+ public OMElement getGreetings2(OMElement requestOM) {
+ String name = requestOM.getFirstElement().getText();
+
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
+ OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
+ responseOM.addChild(param);
+ param.addChild(omFactory.createOMText("Hello2 " + name));
+
+ return responseOM;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM.java
new file mode 100644
index 0000000000..897ac8dcb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM.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.binding.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldOM {
+
+ public OMElement getGreetings(OMElement parmE);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM2.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM2.java
new file mode 100644
index 0000000000..8981541ad8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOM2.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.binding.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+public interface HelloWorldOM2 {
+
+ public OMElement getGreetings2(OMElement parmE);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMComponent.java
new file mode 100644
index 0000000000..6b6abb843f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMComponent.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.binding.axis2.itests;
+
+import org.apache.axiom.om.OMElement;
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldOMComponent implements HelloWorldOM {
+
+ @Reference
+ public HelloWorldOM helloWorldWS;
+
+ public OMElement getGreetings(OMElement om) {
+ return helloWorldWS.getGreetings(om);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMService.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMService.java
new file mode 100644
index 0000000000..861509c003
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMService.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.binding.axis2.itests;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+
+public class HelloWorldOMService implements HelloWorldOM {
+
+ public OMElement getGreetings(OMElement requestOM) {
+ String name = requestOM.getFirstElement().getText();
+
+ OMFactory omFactory = OMAbstractFactory.getOMFactory();
+ OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
+ OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
+ responseOM.addChild(param);
+ param.addChild(omFactory.createOMText("Hello " + name));
+
+ return responseOM;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMTestCase.java
new file mode 100644
index 0000000000..40aa0e4480
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldOMTestCase.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.binding.axis2.itests;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testCalculator() throws Exception {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
+ OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
+ requestOM.addChild(parmE);
+ parmE.addChild(fac.createOMText("petra"));
+ OMElement responseOM = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.composite");
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldService.java
new file mode 100644
index 0000000000..d7d6b93f34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/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 org.apache.tuscany.sca.binding.axis2.itests;
+
+public class HelloWorldService implements HelloWorld {
+
+ public String getGreetings(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldTestCaseFIXME.java
new file mode 100644
index 0000000000..ee42e8cb5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/HelloWorldTestCaseFIXME.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.sca.binding.axis2.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class HelloWorldTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorld helloWorld;
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", helloWorld.getGreetings("petra"));
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.composite");
+ helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.java
new file mode 100644
index 0000000000..11eba9a8c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/QuestionMarkWSDLTestCaseFIXME.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.binding.axis2.itests;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.transport.http.server.HttpUtils;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * TODO: This doesn't work right now as it seems to cause hangs when running
+ * from mvn. Also running in eclipse mostly only works if you comment out
+ * one of the test methods.
+ */
+public class QuestionMarkWSDLTestCaseFIXME extends TestCase {
+
+ private SCADomain domain;
+
+ /**
+ * Tests ?wsdl works and returns the correct port endpoint from the WSDL
+ */
+ public void testWSDLPortEndpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8080/services/HelloWorldWebService?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
+ Port port = service.getPort("HelloWorldSoapPort");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8080/services/HelloWorldWebService", endpoint);
+ }
+
+ /**
+ * Tests ?wsdl works and returns the correct port endpoint from binding.ws with a custom URI
+ */
+ public void testCustomEndpoint() throws Exception {
+ WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlReader.setFeature("javax.wsdl.verbose",false);
+ wsdlReader.setFeature("javax.wsdl.importDocuments",true);
+
+ Definition definition = wsdlReader.readWSDL("http://localhost:8080/HelloWorldService/foo/bar?wsdl");
+ assertNotNull(definition);
+ Service service = definition.getService(new QName("http://helloworld-om", "HelloWorldService"));
+ Port port = service.getPort("HelloWorldSoapPort");
+
+ String endpoint = getEndpoint(port);
+ String ip = HttpUtils.getIpAddress();
+ assertEquals("http://" + ip + ":8080/HelloWorldService/foo/bar", endpoint);
+ }
+
+ protected String getEndpoint(Port port) {
+ List wsdlPortExtensions = port.getExtensibilityElements();
+ for (final Object extension : wsdlPortExtensions) {
+ if (extension instanceof SOAPAddress) {
+ return ((SOAPAddress) extension).getLocationURI();
+ }
+ }
+ throw new RuntimeException("no SOAPAddress");
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/axis2/itests/questionmark-wsdl.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java
new file mode 100644
index 0000000000..b52c10e341
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.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.binding.axis2.itests.endpoints;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMText;
+import org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOM;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractHelloWorldOMTestCase extends TestCase {
+
+ private SCADomain domain;
+ private HelloWorldOM helloWorld;
+
+ public void testCalculator() throws Exception {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
+ OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
+ requestOM.addChild(parmE);
+ parmE.addChild(fac.createOMText("petra"));
+ OMElement responseOM = helloWorld.getGreetings(requestOM);
+ OMElement child = (OMElement)responseOM.getFirstElement();
+ Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
+ }
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiServiceTestCase.java
new file mode 100644
index 0000000000..3f1677fa90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiServiceTestCase.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.binding.axis2.itests.endpoints;
+
+public class DefaultMultiServiceTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleServiceTestCase.java
new file mode 100644
index 0000000000..9b0ee7304d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleServiceTestCase.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.binding.axis2.itests.endpoints;
+
+public class DefaultSingleServiceTestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURITestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURITestCase.java
new file mode 100644
index 0000000000..7155d80100
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURITestCase.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.binding.axis2.itests.endpoints;
+
+public class WSDLExplicitURITestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURITestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURITestCase.java
new file mode 100644
index 0000000000..ce862be74e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURITestCase.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.binding.axis2.itests.endpoints;
+
+public class WSDLRelativeURITestCase extends AbstractHelloWorldOMTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.composite
new file mode 100644
index 0000000000..ceb026d253
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/HelloWorld.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"
+
+ name="HelloWorld">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <!-- interface.java interface="org.apache.tuscany.sca.binding.axis2.itests.HelloWorld" / -->
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiService.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiService.composite
new file mode 100644
index 0000000000..a58b7eb0d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultMultiService.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"
+
+ name="endpoint1">
+
+ <!--
+ exposing a component which has multiple services with a WS binding,
+ endpoint should be <componentURI>/<serviceName> so for this composite:
+ http://localhost:8080/HelloWorldService/service1
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService/HelloWorldOM">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldMultiService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8080/HelloWorldService/helloWorld"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleService.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleService.composite
new file mode 100644
index 0000000000..6b16d9de21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/DefaultSingleService.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"
+
+ name="endpoint1">
+
+ <!--
+ exposing a component with a WS binding, endpoint should be <componentURI>/<serviceName>
+ unless the component has just a single service in which case its just <componentURI>
+ so for this composite: http://localhost:8080/HelloWorldService
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8080/HelloWorldService/helloWorld"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURI.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURI.composite
new file mode 100644
index 0000000000..f20e8e6574
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLExplicitURI.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"
+
+ name="endpoint3">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with an explicit URL
+ so for this composite the service is: http://localhost:8080/myExplicitURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8080/myExplicitURI"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURI.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURI.composite
new file mode 100644
index 0000000000..a9da20141c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/WSDLRelativeURI.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"
+
+ name="endpoint4">
+
+ <!--
+ exposing a component with a WS binding using a WSDL port with a relative URL
+ so for this composite the service is: http://localhost:8080/HelloWorldService/myRelativeURI
+ -->
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.binding(HelloWorldSoapBinding)"
+ uri="http://localhost:8080/HelloWorldService/helloWorld/myRelativeURI"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl
new file mode 100644
index 0000000000..cd63064b59
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/endpoints/helloworld-om-relative-uri.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-om-relative-uri" xmlns:tns="http://helloworld-om-relative-uri" 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-om">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-relative-uri" 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="myRelativeURI"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om-uri.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om-uri.wsdl
new file mode 100644
index 0000000000..456676e068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om-uri.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-om-uri" xmlns:tns="http://helloworld-om-uri" 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-om">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-uri" 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/myExplicitURI"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.composite
new file mode 100644
index 0000000000..8c861c84be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.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"
+
+ name="HelloWorldOM">
+
+ <service name="helloWorld" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws/>
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMComponent"/>
+ <reference name="helloWorldWS" />
+ </component>
+
+ <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
+ uri="http://localhost:8080/HelloWorldService/helloWorld" />
+ <!-- binding.ws uri="http://localhost:8080/HelloWorldService/helloWorld" / -->
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.wsdl
new file mode 100644
index 0000000000..73ca02246d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld-om.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-om" xmlns:tns="http://helloworld-om" 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-om">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om" 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://endpoint.not.used"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld.wsdl
new file mode 100644
index 0000000000..68174d1ecd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/helloworld.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 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/services/HelloWorldWebService"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/questionmark-wsdl.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/questionmark-wsdl.composite
new file mode 100644
index 0000000000..fca9a4d754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/axis2/itests/questionmark-wsdl.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+
+ name="QuestionMarkWSDLTests">
+
+ <service name="ep1" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </service>
+
+ <service name="ep2" promote="HelloWorldService">
+ <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
+ <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)" uri="foo/bar" />
+ </service>
+
+ <component name="HelloWorldService">
+ <implementation.java class="org.apache.tuscany.sca.binding.axis2.itests.HelloWorldOMService"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/.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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/pom.xml
new file mode 100644
index 0000000000..acc305308d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-ws-xml</artifactId>
+ <name>Apache Tuscany SCA XML Web Service Binding Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
new file mode 100644
index 0000000000..36afd1d92b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
@@ -0,0 +1,334 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+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.assembly.xml.Constants;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+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.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class WebServiceBindingProcessor implements
+ StAXArtifactProcessor<WebServiceBinding>, WebServiceConstants {
+
+ private WSDLFactory wsdlFactory;
+ private WSDLInterfaceIntrospector introspector;
+ private WebServiceBindingFactory wsFactory;
+ private PolicyFactory policyFactory;
+
+ public WebServiceBindingProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ WebServiceBindingFactory wsFactory,
+ WSDLFactory wsdlFactory,
+ WSDLInterfaceIntrospector introspector) {
+ this.policyFactory = policyFactory;
+ this.wsFactory = wsFactory;
+ this.introspector = introspector;
+ this.wsdlFactory = wsdlFactory;
+ }
+
+ public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException {
+ try {
+
+ // Read a <binding.ws>
+ WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
+ wsBinding.setUnresolved(true);
+
+ // Read policies
+ readPolicies(wsBinding, reader);
+
+ // Read URI
+ wsBinding.setURI(reader.getAttributeValue(null, Constants.URI));
+
+ // Read a qname in the form:
+ // namespace#wsdl.???(name)
+ String wsdlElement = reader.getAttributeValue(null, WSDL_ELEMENT);
+ if (wsdlElement != null) {
+ int index = wsdlElement.indexOf('#');
+ if (index == -1) {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ String namespace = wsdlElement.substring(0, index);
+ wsBinding.setNamespace(namespace);
+ String name = wsdlElement.substring(index + 1);
+ if (name.startsWith("wsdl.service")) {
+
+ // Read a wsdl.service
+ name = name.substring("wsdl.service(".length(), name.length() - 1);
+ wsBinding.setServiceName(new QName(namespace, name));
+
+ } else if (name.startsWith("wsdl.port")) {
+
+ // Read a wsdl.port
+ name = name.substring("wsdl.port(".length(), name.length() - 1);
+ int s = name.indexOf('/');
+ if (s == -1) {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ wsBinding.setServiceName(new QName(namespace, name.substring(0, s)));
+ wsBinding.setPortName(name.substring(s + 1));
+
+ } else if (name.startsWith("wsdl.endpoint")) {
+
+ // Read a wsdl.endpoint
+ name = name.substring("wsdl.endpoint(".length(), name.length() - 1);
+ int s = name.indexOf('/');
+ if (s == -1) {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ wsBinding.setServiceName(new QName(namespace, name.substring(0, s)));
+ wsBinding.setEndpointName(name.substring(s + 1));
+
+ } else if (name.startsWith("wsdl.binding")) {
+
+ // Read a wsdl.service
+ name = name.substring("wsdl.binding(".length(), name.length() - 1);
+ wsBinding.setBindingName(new QName(namespace, name));
+
+ } else {
+ throw new ContributionReadException(
+ "Invalid WebService binding wsdlElement attribute: " + wsdlElement);
+ }
+ }
+
+ // Read wsdlLocation
+ wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && BINDING_WS_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return wsBinding;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(WebServiceBinding wsBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write a <binding.ws>
+ writer.writeStartElement(Constants.SCA10_NS, BINDING_WS);
+
+ // Write binding URI
+ if (wsBinding.getURI() != null) {
+ writer.writeAttribute(Constants.URI, wsBinding.getURI());
+ }
+
+ // Write wsdlElement attribute
+ if (wsBinding.getPortName() != null) {
+
+ // Write namespace#wsdl.port(service/port)
+ String wsdlElement = wsBinding.getServiceName().getNamespaceURI() + "#wsdl.port("
+ + wsBinding.getServiceName().getLocalPart()
+ + "/"
+ + wsBinding.getPortName()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getEndpointName() != null) {
+
+ // Write namespace#wsdl.endpoint(service/endpoint)
+ String wsdlElement = wsBinding.getServiceName().getNamespaceURI() + "#wsdl.endpoint("
+ + wsBinding.getServiceName().getLocalPart()
+ + "/"
+ + wsBinding.getEndpointName()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getBindingName() != null) {
+
+ // Write namespace#wsdl.binding(binding)
+ String wsdlElement = wsBinding.getBindingName().getNamespaceURI() + "#wsdl.binding("
+ + wsBinding.getBindingName().getLocalPart()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+
+ } else if (wsBinding.getServiceName() != null) {
+
+ // Write namespace#wsdl.service(service)
+ String wsdlElement = wsBinding.getServiceName().getNamespaceURI() + "#wsdl.service("
+ + wsBinding.getServiceName().getLocalPart()
+ + ")";
+ writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
+ }
+
+ // Write location
+ if (wsBinding.getLocation() != null) {
+ writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsBinding.getLocation());
+ }
+
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(WebServiceBinding model, ModelResolver resolver) throws ContributionResolveException {
+ WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+ wsdlDefinition.setUnresolved(true);
+ wsdlDefinition.setNamespace(model.getNamespace());
+ wsdlDefinition = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
+ if (!wsdlDefinition.isUnresolved()) {
+ model.setDefinition(wsdlDefinition);
+ Definition definition = wsdlDefinition.getDefinition();
+ if (model.getBindingName() != null) {
+ model.setBinding(definition.getBinding(model.getBindingName()));
+ }
+ if (model.getServiceName() != null) {
+ Service service = definition.getService(model.getServiceName());
+ model.setService(service);
+ if (service != null && model.getPortName() != null) {
+ Port port = service.getPort(model.getPortName());
+ model.setPort(port);
+ model.setBinding(port.getBinding());
+ }
+ }
+
+ PortType portType = getPortType(model);
+ if (portType != null) {
+ WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
+ WSDLInterface wsdlInterface;
+ try {
+ wsdlInterface = introspector.introspect(portType,
+ wsdlDefinition.getInlinedSchemas(),
+ resolver);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ interfaceContract.setInterface(wsdlInterface);
+ model.setBindingInterfaceContract(interfaceContract);
+ }
+ }
+ }
+
+ private PortType getPortType(WebServiceBinding model) {
+ PortType portType = null;
+ if (model.getService() != null) {
+ // FIXME: How to find the compatible port?
+ Map ports = model.getService().getPorts();
+ if (!ports.isEmpty()) {
+ Port port = (Port)ports.values().iterator().next();
+ portType = port.getBinding().getPortType();
+ }
+ } else if (model.getPort() != null) {
+ portType = model.getPort().getBinding().getPortType();
+ } else if (model.getEndpoint() != null) {
+ portType = model.getPort().getBinding().getPortType();
+ } else if (model.getBinding() != null) {
+ portType = model.getBinding().getPortType();
+ }
+ return portType;
+ }
+
+ public QName getArtifactType() {
+ return WebServiceConstants.BINDING_WS_QNAME;
+ }
+
+ public Class<WebServiceBinding> getModelType() {
+ return WebServiceBinding.class;
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ private void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ requiredIntents.add(intent);
+ }
+ }
+
+ value = reader.getAttributeValue(null, Constants.POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ policySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Returns a qname from a string.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java
new file mode 100644
index 0000000000..34d0fc4949
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.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.binding.ws.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface WebServiceConstants {
+
+ String BINDING_WS = "binding.ws";
+ QName BINDING_WS_QNAME = new QName(Constants.SCA10_NS, BINDING_WS);
+ String WSDL_ELEMENT = "wsdlElement";
+ QName WSDL_ELEMENT_QNAME = new QName(Constants.SCA10_NS, WSDL_ELEMENT);
+ String WSDL_LOCATION = "wsdlLocation";
+ String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
+ QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
new file mode 100644
index 0000000000..8a0e462624
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.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.binding.ws.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.DefaultWSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private WebServiceBindingFactory wsFactory;
+ private WSDLInterfaceIntrospector introspector;
+ private WSDLFactory wsdlFactory;
+
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ wsFactory = new DefaultWebServiceBindingFactory();
+ wsdlFactory = new DefaultWSDLFactory();
+
+ introspector = new DefaultWSDLInterfaceIntrospector(wsdlFactory);
+
+ WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(
+ assemblyFactory, policyFactory, wsFactory,
+ wsdlFactory, introspector);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ staxProcessor = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeProcessor.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
new file mode 100644
index 0000000000..b686cbacaf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.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.binding.ws.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.DefaultWSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private WebServiceBindingFactory wsFactory;
+ private WSDLInterfaceIntrospector introspector;
+ private WSDLFactory wsdlFactory;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ wsFactory = new DefaultWebServiceBindingFactory();
+ introspector = new DefaultWSDLInterfaceIntrospector(wsdlFactory);
+ wsdlFactory = new DefaultWSDLFactory();
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ WebServiceBindingProcessor wsdlProcessor = new WebServiceBindingProcessor(
+ factory, policyFactory, wsFactory,
+ wsdlFactory, introspector);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
new file mode 100644
index 0000000000..957ef38753
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8080/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..01121f6771
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
@@ -0,0 +1,40 @@
+<?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/2004/08/wsdl-instance">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
+ <binding.ws uri="http://localhost:8080/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
+ <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
+ <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.service(DivideService)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(DivideBinding)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.port(DivideService/DividePort)"/>
+ <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.endpoint(DivideService/DivideEndpoint)"/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl
new file mode 100644
index 0000000000..5e8e5dad0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://www.example.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ name="example">
+
+ <wsdl:portType name="HelloWorld">
+ </wsdl:portType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
new file mode 100644
index 0000000000..ad81fc7867
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice1">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
new file mode 100644
index 0000000000..39cd5547d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl
new file mode 100644
index 0000000000..06bdc5510c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl
@@ -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.
+-->
+<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:import location="test2.wsdl" namespace="http://helloworld"></wsdl:import>
+
+ <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-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
new file mode 100644
index 0000000000..c2210f4a94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
@@ -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.
+-->
+<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO" xmlns:tns="http://www.example.com/Customer">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <complexType name="Customer">
+ <sequence>
+ <element name="customerID" type="string"></element>
+ <element name="name" type="string"></element>
+ <element name="order" type="ipo:PurchaseOrderType" />
+ </sequence>
+ </complexType>
+ <element name="customer" type="tns:Customer"></element>
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl
new file mode 100644
index 0000000000..529b395fd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl
@@ -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.
+-->
+<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">
+
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <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:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl
new file mode 100644
index 0000000000..666a7e4069
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl
@@ -0,0 +1,76 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput1">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput1">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <message name="GetLastTradePriceInput2">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ <part name="other" type="xsd:string"/>
+ </message>
+
+ <message name="GetLastTradePriceOutput2">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice1">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice2">
+ <input message="tns:GetLastTradePriceInput2" />
+ <output message="tns:GetLastTradePriceOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/.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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/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/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/pom.xml
new file mode 100644
index 0000000000..46f5663a8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-binding-ws</artifactId>
+ <name>Apache Tuscany Web Service Binding Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <!-- Apache repository for Web Services artifacts -->
+ <repository>
+ <id>apache.ws.zone</id>
+ <name>Apache WS Zone Repository</name>
+ <url>http://ws.zones.apache.org/repository2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java
new file mode 100644
index 0000000000..04f8ab0d3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.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.binding.ws;
+
+import org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingFactoryImpl;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWebServiceBindingFactory extends WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
new file mode 100644
index 0000000000..ecfd9cfbc7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws;
+
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+
+
+/**
+ * Represents a WebService binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WebServiceBinding extends Binding {
+
+ /**
+ * Sets the WSDL location.
+ * @param location the WSDL location
+ */
+ void setLocation(String location);
+
+ /**
+ * Returns the WSDL location
+ * @return the WSDL location
+ */
+ String getLocation();
+
+ /**
+ * Returns the name of the WSDL service.
+ *
+ * @return the name of the WSDL service
+ */
+ QName getServiceName();
+
+ /**
+ * Sets the name of the WSDL service.
+ *
+ * @param className the name of the WSDL service
+ */
+ void setServiceName(QName serviceName);
+
+ /**
+ * Returns the name of the WSDL port.
+ *
+ * @return the name of the WSDL port
+ */
+ String getPortName();
+
+ /**
+ * Sets the name of the WSDL port.
+ *
+ * @param className the name of the WSDL port
+ */
+ void setPortName(String portName);
+
+ /**
+ * Returns the name of the WSDL binding.
+ *
+ * @return the name of the WSDL binding
+ */
+ QName getBindingName();
+
+ /**
+ * Sets the name of the WSDL binding.
+ *
+ * @param className the name of the WSDL binding
+ */
+ void setBindingName(QName bindingName);
+
+ /**
+ * Returns the name of the WSDL endpoint.
+ *
+ * @return the name of the WSDL endpoint
+ */
+ String getEndpointName();
+
+ /**
+ * Sets the name of the WSDL endpoint.
+ *
+ * @param className the name of the WSDL endpoint
+ */
+ void setEndpointName(String endpointName);
+
+ /**
+ * Returns the WSDL service
+ * @return the WSDL service
+ */
+ Service getService();
+
+ /**
+ * Sets the WSDL service.
+ * @param service the WSDL service
+ */
+ void setService(Service service);
+
+ /**
+ * Returns the WSDL port
+ * @return the WSDL port
+ */
+ Port getPort();
+
+ /**
+ * Sets the WSDL endpoint
+ * @param port the WSDL endpoint
+ */
+ void setEndpoint(Port endpoint);
+
+ /**
+ * Returns the WSDL endpoint
+ * @return the WSDL endpoint
+ */
+ Port getEndpoint();
+
+ /**
+ * Sets the WSDL port
+ * @param port the WSDL port
+ */
+ void setPort(Port port);
+
+ /**
+ * Returns the WSDL binding.
+ * @return the WSDL binding
+ */
+ javax.wsdl.Binding getBinding();
+
+ /**
+ * Sets the WSDL binding
+ * @param binding the WSDL binding
+ */
+ void setBinding(javax.wsdl.Binding binding);
+
+ /**
+ * Returns the WSDL binding.
+ * @return the WSDL binding
+ */
+ WSDLDefinition getWSDLDefinition();
+
+ /**
+ * Sets the WSDL binding
+ * @param binding the WSDL binding
+ */
+ void setDefinition(WSDLDefinition wsdlDefinition);
+
+ /**
+ * Returns the WSDL namespace.
+ * @return the WSDL namespace
+ */
+ String getNamespace();
+
+ /**
+ * Sets the WSDL namespace
+ * @param namspace the WSDL namspace
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ InterfaceContract getBindingInterfaceContract();
+
+ void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java
new file mode 100644
index 0000000000..1ad38c69e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.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.binding.ws;
+
+/**
+ * Factory for the Web Service binding model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WebServiceBindingFactory {
+
+ /**
+ * Creates a new WebService binding.
+ *
+ * @return a new WebService binding
+ */
+ WebServiceBinding createWebServiceBinding();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java
new file mode 100644
index 0000000000..8902dd04ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.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.binding.ws.impl;
+
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
+
+ public WebServiceBinding createWebServiceBinding() {
+ return new WebServiceBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
new file mode 100644
index 0000000000..910fb652a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
@@ -0,0 +1,242 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.binding.ws.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a WebService binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WebServiceBindingImpl implements WebServiceBinding {
+ private String name;
+ private String uri;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private boolean unresolved;
+ private List<Object> extensions = new ArrayList<Object>();
+
+ private String location;
+ private Binding binding;
+ private Service service;
+ private Port port;
+ private Port endpoint;
+ private QName bindingName;
+ private String portName;
+ private QName serviceName;
+ private String endpointName;
+ private WSDLDefinition wsdlDefinition;
+ private String wsdlNamespace;
+ private InterfaceContract bindingInterfaceContract;
+
+ protected WebServiceBindingImpl() {
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public QName getBindingName() {
+ if (isUnresolved()) {
+ return bindingName;
+ } else if (binding != null) {
+ return binding.getQName();
+ } else {
+ return null;
+ }
+ }
+
+ public String getEndpointName() {
+ if (isUnresolved()) {
+ return endpointName;
+ } else if (endpoint != null) {
+ //TODO support WSDL 2.0
+ return endpoint.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public Port getEndpoint() {
+ return endpoint;
+ }
+
+ public Port getPort() {
+ return port;
+ }
+
+ public String getPortName() {
+ if (isUnresolved()) {
+ return portName;
+ } else if (port != null) {
+ return port.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public Service getService() {
+ return service;
+ }
+
+ public QName getServiceName() {
+ if (isUnresolved()) {
+ return serviceName;
+ } else if (service != null) {
+ return service.getQName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ }
+
+ public void setBindingName(QName bindingName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.bindingName = bindingName;
+ }
+
+ public void setEndpoint(Port endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void setEndpointName(String endpointName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.endpointName = endpointName;
+ }
+
+ public void setPort(Port port) {
+ this.port = port;
+ }
+
+ public void setPortName(String portName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.portName = portName;
+ }
+
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ public void setServiceName(QName serviceName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.serviceName = serviceName;
+ }
+
+ public WSDLDefinition getWSDLDefinition() {
+ if (wsdlDefinition == null) {
+ Interface iface = bindingInterfaceContract.getInterface();
+ if (iface instanceof WSDLInterface) {
+ wsdlDefinition = ((WSDLInterface) iface).getWsdlDefinition();
+ }
+ }
+ return wsdlDefinition;
+ }
+
+ public void setDefinition(WSDLDefinition wsdlDefinition) {
+ this.wsdlDefinition = wsdlDefinition;
+ }
+
+ public String getNamespace() {
+ return wsdlNamespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.wsdlNamespace = namespace;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return bindingInterfaceContract;
+ }
+
+ public void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract) {
+ this.bindingInterfaceContract = bindingInterfaceContract;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/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/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/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/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/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/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/pom.xml
new file mode 100644
index 0000000000..cf8baa9123
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <name>Apache Tuscany Commonj API for Timer and Work Manager</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ <defaultGoal>install</defaultGoal>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/CancelTimerListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/CancelTimerListener.java
new file mode 100644
index 0000000000..ba252e70dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/CancelTimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface CancelTimerListener extends TimerListener {
+
+ void timerCancel(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/StopTimerListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/StopTimerListener.java
new file mode 100644
index 0000000000..92defc4bdc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/StopTimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface StopTimerListener extends TimerListener {
+
+ void timerStop(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/Timer.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/Timer.java
new file mode 100644
index 0000000000..0a5c3b65fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/Timer.java
@@ -0,0 +1,41 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Timer {
+
+ boolean cancel();
+ long getPeriod();
+ long getScheduledExecutionTime() throws IllegalStateException;
+ TimerListener getTimerListener();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerListener.java
new file mode 100644
index 0000000000..6e3733b5f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerListener.java
@@ -0,0 +1,38 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TimerListener {
+
+ void timerExpired(Timer timer);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerManager.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerManager.java
new file mode 100644
index 0000000000..c07b6478d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/timers/TimerManager.java
@@ -0,0 +1,79 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.timers;
+
+import java.util.Date;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface TimerManager {
+
+ static final long IMMEDIATE = 0;
+ static final long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ boolean isStopped();
+
+ boolean isStopping();
+
+ boolean isSuspended() throws IllegalStateException;
+
+ boolean isSuspending() throws IllegalStateException;
+
+ void resume() throws IllegalStateException;
+
+ Timer schedule(TimerListener listener, long delayInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, long delayInMillis, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, Date scheduleDate)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer schedule(TimerListener listener, Date scheduleDate, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer scheduleAtFixedRate(TimerListener listener, long delayInMillis, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ Timer scheduleAtFixedRate(TimerListener listener, Date scheduleDate, long repeatIntervalInMillis)
+ throws IllegalStateException, IllegalArgumentException;
+
+ void stop() throws IllegalStateException;
+
+ void suspend() throws IllegalStateException;
+
+ boolean waitForStop(long timeOut)
+ throws InterruptedException, IllegalArgumentException;
+
+ boolean waitForSuspend(long timOut)
+ throws InterruptedException, IllegalStateException, IllegalArgumentException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/RemoteWorkItem.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/RemoteWorkItem.java
new file mode 100644
index 0000000000..f079dce312
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/RemoteWorkItem.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface RemoteWorkItem extends WorkItem {
+
+ WorkManager getPinnedWorkManager();
+ void release();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/Work.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/Work.java
new file mode 100644
index 0000000000..1071fe4a2e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/Work.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Work extends Runnable {
+
+ boolean isDaemon();
+ void release();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkCompletedException.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkCompletedException.java
new file mode 100644
index 0000000000..21786c4b99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkCompletedException.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkCompletedException extends WorkException {
+ private static final long serialVersionUID = 1L;
+
+ private final List exceptionList;
+
+ public WorkCompletedException() {
+ super();
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ public WorkCompletedException(String message) {
+ super(message);
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ public WorkCompletedException(String message, Throwable cause) {
+ super(message, cause);
+ exceptionList = Collections.singletonList(cause);
+ }
+ public WorkCompletedException(Throwable cause) {
+ super(cause);
+ exceptionList = Collections.singletonList(cause);
+ }
+ public WorkCompletedException(String message, List list) {
+ super(message);
+ if ((list != null) && (list.size() > 0)) {
+ initCause((Throwable) list.get(0));
+ exceptionList = Collections.unmodifiableList(new ArrayList(list));
+ } else {
+ exceptionList = Collections.EMPTY_LIST;
+ }
+ }
+
+ public List getExceptionList() {
+ return exceptionList;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkEvent.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkEvent.java
new file mode 100644
index 0000000000..9a7814b860
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkEvent.java
@@ -0,0 +1,45 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkEvent {
+
+ static final int WORK_ACCEPTED = 1;
+ static final int WORK_REJECTED = 2;
+ static final int WORK_STARTED = 3;
+ static final int WORK_COMPLETED = 4;
+
+ WorkException getException();
+ int getType();
+ WorkItem getWorkItem();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkException.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkException.java
new file mode 100644
index 0000000000..3d24ec1055
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkException.java
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public WorkException() {
+ super();
+ }
+ public WorkException(String message) {
+ super(message);
+ }
+ public WorkException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public WorkException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkItem.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkItem.java
new file mode 100644
index 0000000000..6b8d3185a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkItem.java
@@ -0,0 +1,39 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkItem extends Comparable {
+
+ Work getResult() throws WorkException;
+ int getStatus();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkListener.java
new file mode 100644
index 0000000000..9b523f7321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkListener.java
@@ -0,0 +1,44 @@
+/**
+ *
+ * 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.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkListener {
+
+ static long IMMEDIATE = 0;
+ static long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ void workAccepted(WorkEvent event);
+ void workCompleted(WorkEvent event);
+ void workRejected(WorkEvent event);
+ void workStarted(WorkEvent event);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkManager.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkManager.java
new file mode 100644
index 0000000000..2c4167d24c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkManager.java
@@ -0,0 +1,51 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+import java.util.Collection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface WorkManager {
+
+ static final long IMMEDIATE = 0;
+ static final long INDEFINITE = java.lang.Long.MAX_VALUE;
+
+ WorkItem schedule(Work work) throws WorkException, IllegalArgumentException;
+
+ WorkItem schedule(Work work, WorkListener listener) throws WorkException, IllegalArgumentException;
+
+ boolean waitForAll(Collection workItems, long timeout)
+ throws InterruptedException, IllegalArgumentException;
+
+ Collection waitForAny(Collection workItems, long timeout)
+ throws InterruptedException, IllegalArgumentException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkRejectedException.java b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkRejectedException.java
new file mode 100644
index 0000000000..cee8ea588a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/commonj-api/src/main/java/commonj/work/WorkRejectedException.java
@@ -0,0 +1,50 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// This source code implements specifications defined by the BEA and IBM.
+// For more information, see:
+// http://dev2dev.bea.com/technologies/commonj/index.jsp
+// or
+// http://www.ibm.com/developerworks/library/j-commonj-sdowmt
+//
+// In order to remain compliant with the specification
+// DO NOT add / change / or delete method signatures!
+//
+
+package commonj.work;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WorkRejectedException extends WorkException {
+ private static final long serialVersionUID = 1L;
+
+ public WorkRejectedException() {
+ super();
+ }
+ public WorkRejectedException(String message) {
+ super(message);
+ }
+ public WorkRejectedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+ public WorkRejectedException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.checkstyle
new file mode 100644
index 0000000000..ace5fe6f53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.checkstyle
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <fileset name="all" enabled="true" check-config-name="Sun Checks" local="false">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ </fileset>
+</fileset-config>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.pmd
new file mode 100644
index 0000000000..84af2f4d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.ruleset
new file mode 100644
index 0000000000..ac8671859d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/.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/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/pom.xml
new file mode 100644
index 0000000000..9dbc9bb569
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/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-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <name>Apache Tuscany SCA Contribution Service Implementation</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
new file mode 100644
index 0000000000..daf9f2289f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+
+
+/**
+ * Base Artifact interface to accomodate common properties between Contribution and Deployed Artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class ArtifactImpl implements Artifact {
+ private String uri;
+ private String location;
+
+ protected ArtifactImpl() {
+ }
+
+ public String getLocation() {
+ return this.location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getURI() {
+ return this.uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionExportImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionExportImpl.java
new file mode 100644
index 0000000000..90bde0f67e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionExportImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.ContributionExport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionExportImpl implements ContributionExport {
+ private String namespace; // The namespace to be imported
+ private ModelResolver modelResolver;
+
+ protected ContributionExportImpl() {
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
new file mode 100644
index 0000000000..a349939a0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionExport;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ContributionImport;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+
+/**
+ * Contribution model object factory
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionFactoryImpl implements ContributionFactory {
+
+ public Contribution createContribution() {
+ return new ContributionImpl();
+ }
+
+ public DeployedArtifact createDeployedArtifact() {
+ return new DeployedArtifactImpl();
+ }
+
+ public ContributionImport createContributionImport() {
+ return new ContributionImportImpl();
+ }
+
+ public ContributionExport createContributionExport() {
+ return new ContributionExportImpl();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
new file mode 100644
index 0000000000..8d246eaf1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.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.sca.contribution.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionExport;
+import org.apache.tuscany.sca.contribution.ContributionImport;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev: 531146 $ $Date: 2007-04-21 22:40:50 -0700 (Sat, 21 Apr 2007) $
+ */
+public class ContributionImpl extends ArtifactImpl implements Contribution {
+ private List<ContributionExport> exports = new ArrayList<ContributionExport>();
+ private List<ContributionImport> imports = new ArrayList<ContributionImport>();
+ private List<Composite> deployables = new ArrayList<Composite>();
+ private ModelResolver modelResolver;
+
+ /**
+ * A list of artifacts in the contribution
+ */
+ private List<DeployedArtifact> artifacts = new ArrayList<DeployedArtifact>();
+
+ protected ContributionImpl() {
+ }
+
+ public List<ContributionExport> getExports() {
+ return exports;
+ }
+
+ public List<ContributionImport> getImports() {
+ return imports;
+ }
+
+ public List<Composite> getDeployables() {
+ return deployables;
+ }
+
+ public List<DeployedArtifact> getArtifacts() {
+ return artifacts;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImportImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImportImpl.java
new file mode 100644
index 0000000000..3f241ff3d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImportImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.ContributionImport;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
+ */
+public class ContributionImportImpl implements ContributionImport {
+ private String namespace; // The namespace to be imported
+ private String location; // Optional location to hint the where it should be imported
+ private ModelResolver modelResolver;
+
+ protected ContributionImportImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public ModelResolver getModelResolver() {
+ return modelResolver;
+ }
+
+ public void setModelResolver(ModelResolver modelResolver) {
+ this.modelResolver = modelResolver;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.java
new file mode 100644
index 0000000000..1d9bb04114
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/impl/DeployedArtifactImpl.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.contribution.impl;
+
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
+ */
+public class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
+ private Object modelObject;
+
+ protected DeployedArtifactImpl() {
+ super();
+ }
+
+ public Object getModel() {
+ return modelObject;
+ }
+
+ public void setModel(Object modelObject) {
+ this.modelObject = modelObject;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
new file mode 100644
index 0000000000..5e22363f41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.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.contribution.processor.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+/**
+ * Folder contribution package processor
+ *
+ * @version $Rev$ $Date$
+ */
+public class FolderContributionProcessor implements PackageProcessor {
+ /**
+ * Package-type that this package processor can handle
+ */
+ public static final String PACKAGE_TYPE = ContentType.FOLDER;
+
+ public FolderContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PACKAGE_TYPE;
+ }
+
+ /**
+ * Recursively traverse a root directory
+ *
+ * @param fileList
+ * @param file
+ * @throws IOException
+ */
+ private void traverse(List<URI> fileList, File file, File root) throws IOException {
+ if (file.isFile()) {
+ fileList.add(root.toURI().relativize(file.toURI()));
+ } else if (file.isDirectory()) {
+ // FIXME: Maybe we should externalize it as a property
+ // Regular expression to exclude .xxx files
+ File[] files = file.listFiles(FileHelper.getFileFilter("[^\u002e].*", true));
+ for (int i = 0; i < files.length; i++) {
+ traverse(fileList, files[i], root);
+ }
+ }
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ return new URL(sourceURL, artifact.toString());
+ }
+
+ /**
+ * Get a list of artifact URI from the folder
+ *
+ * @return The list of artifact URI for the folder
+ * @throws IOException
+ */
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ List<URI> artifacts = new ArrayList<URI>();
+
+ // Assume the root is a jar file
+ File rootFolder;
+
+ try {
+ rootFolder = new File(packageSourceURL.toURI());
+ if (rootFolder.isDirectory()) {
+ if (!rootFolder.exists()) {
+ throw new InvalidFolderContributionException(rootFolder.getAbsolutePath());
+ }
+
+ this.traverse(artifacts, rootFolder, rootFolder);
+ }
+
+ } catch (URISyntaxException e) {
+ throw new InvalidFolderContributionURIException(packageSourceURL.toExternalForm(), e);
+ }
+
+ return artifacts;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.java
new file mode 100644
index 0000000000..6dbab56553
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionException.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.sca.contribution.processor.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidFolderContributionException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1564255850052593282L;
+
+ protected InvalidFolderContributionException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidFolderContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.java
new file mode 100644
index 0000000000..8022834438
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/InvalidFolderContributionURIException.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.sca.contribution.processor.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ */
+public class InvalidFolderContributionURIException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1564255850052593282L;
+
+ protected InvalidFolderContributionURIException(String componentDefinitionLocatoin) {
+ super(componentDefinitionLocatoin);
+ }
+
+ protected InvalidFolderContributionURIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
new file mode 100644
index 0000000000..4ffec693d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.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.contribution.processor.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Jar Contribution package processor
+ *
+ * @version $Rev$ $Date$
+ */
+public class JarContributionProcessor implements PackageProcessor {
+ /**
+ * Package-type that this package processor can handle
+ */
+ public static final String PACKAGE_TYPE = ContentType.JAR;
+
+ public JarContributionProcessor() {
+ }
+
+ public String getPackageType() {
+ return PACKAGE_TYPE;
+ }
+
+ public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
+ if (sourceURL.toString().startsWith("jar:")) {
+ return new URL(sourceURL, artifact.toString());
+ } else {
+ return new URL("jar:" + sourceURL.toExternalForm() + "!/" + artifact);
+ }
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
+ IOException {
+ if (packageSourceURL == null) {
+ throw new IllegalArgumentException("Invalid null package source URL.");
+ }
+
+ if (inputStream == null) {
+ throw new IllegalArgumentException("Invalid null source inputstream.");
+ }
+
+ List<URI> artifacts = new ArrayList<URI>();
+
+ // Assume the root is a jar file
+ JarInputStream jar = new JarInputStream(inputStream);
+ try {
+ while (true) {
+ JarEntry entry = jar.getNextJarEntry();
+ if (entry == null) {
+ // EOF
+ break;
+ }
+ if (entry.isDirectory()) {
+ continue;
+ }
+
+ // FIXME: Maybe we should externalize the filter as a property
+ if (!entry.getName().startsWith(".")) {
+ artifacts.add(URI.create(entry.getName()));
+ }
+ }
+ } finally {
+ jar.close();
+ }
+ return artifacts;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/ModelResolverImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/ModelResolverImpl.java
new file mode 100644
index 0000000000..ffc82b908f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/resolver/impl/ModelResolverImpl.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.sca.contribution.resolver.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ModelResolverImpl implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public ModelResolverImpl(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ 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 if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.java
new file mode 100644
index 0000000000..174a09a0c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ArtifactTypeDescriberImpl.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.contribution.service.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+/**
+ * Implementation of the content describer for files
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactTypeDescriberImpl implements TypeDescriber {
+ private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
+
+ public ArtifactTypeDescriberImpl() {
+ super();
+ init();
+ }
+
+ /**
+ * Initialize contentType registry with know types based on known file extensions
+ */
+ private void init() {
+ contentTypeRegistry.put("COMPOSITE", ContentType.COMPOSITE);
+ contentTypeRegistry.put("SCDL", ContentType.COMPOSITE);
+ contentTypeRegistry.put("WSDL", ContentType.WSDL);
+ contentTypeRegistry.put("JAR", ContentType.JAR);
+ }
+
+ protected String resolveContentyTypeByExtension(URL resourceURL) {
+ String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
+ if (artifactExtension == null) {
+ return null;
+ }
+ return contentTypeRegistry.get(artifactExtension.toUpperCase());
+ }
+
+ /**
+ * Build contentType for a specific resource. We first check if the file is
+ * a supported one (looking into our registry based on resource extension)
+ * If not found, we try to check file contentType Or we return
+ * defaultContentType provided
+ *
+ * @param resourceURL The artifact url
+ * @param defaultContentType The default content type if we can't find the correc one
+ * @return The content type
+ */
+ public String getType(URL resourceURL, String defaultContentType) {
+ URLConnection connection = null;
+ String contentType = defaultContentType;
+
+ if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
+ // Special case : contribution is a folder
+ contentType = ContentType.FOLDER;
+ } else if (resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_META)
+ || resourceURL.toExternalForm().endsWith(Contribution.SCA_CONTRIBUTION_GENERATED_META)) {
+ // Special case : contribution metadata
+ contentType = ContentType.CONTRIBUTION_METADATA;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ contentType = connection.getContentType();
+
+ if (contentType == null || contentType.equals("content/unknown")) {
+ // here we couldn't figure out from our registry or from URL and it's not a special file
+ // return defaultContentType if provided
+ contentType = defaultContentType;
+ }
+ } catch (IOException io) {
+ // could not access artifact, just ignore and we will return
+ // null contentType
+ }
+ }
+ }
+ return contentType == null ? defaultContentType : contentType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataLoaderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataLoaderImpl.java
new file mode 100644
index 0000000000..a089756308
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionMetadataLoaderImpl.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.sca.contribution.service.impl;
+
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionExport;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.ContributionImport;
+import org.apache.tuscany.sca.contribution.service.ContributionMetadataLoader;
+import org.apache.tuscany.sca.contribution.service.ContributionMetadataLoaderException;
+
+/**
+ * Loader that handles contribution metadata files
+ *
+ * @version $Rev: 515261 $ $Date: 2007-03-06 11:22:46 -0800 (Tue, 06 Mar 2007) $
+ */
+public class ContributionMetadataLoaderImpl implements ContributionMetadataLoader {
+ private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
+ private static final String TARGET_NAMESPACE = "targetNamespace";
+
+ private static final QName CONTRIBUTION = new QName(SCA10_NS, "contribution");
+ private static final QName DEPLOYABLE = new QName(SCA10_NS, "deployable");
+ private static final QName IMPORT = new QName(SCA10_NS, "import");
+ private static final QName EXPORT = new QName(SCA10_NS, "export");
+
+ private final AssemblyFactory assemblyFactory;
+ private final ContributionFactory contributionFactory;
+
+ public ContributionMetadataLoaderImpl(AssemblyFactory assemblyFactory, ContributionFactory contributionFactory) {
+ super();
+ this.assemblyFactory = assemblyFactory;
+ this.contributionFactory = contributionFactory;
+ }
+
+ public QName getXMLType() {
+ return CONTRIBUTION;
+ }
+
+ public void load(Contribution contribution, XMLStreamReader reader) throws XMLStreamException, ContributionMetadataLoaderException {
+ String targetNameSpaceURI = null;
+
+ while (true) {
+ int event = reader.next();
+ switch (event) {
+ case START_ELEMENT:
+ QName element = reader.getName();
+ if (CONTRIBUTION.equals(element)) {
+ targetNameSpaceURI = reader.getAttributeValue(null, TARGET_NAMESPACE);
+ } else if (DEPLOYABLE.equals(element)) {
+ String name = reader.getAttributeValue(null, "composite");
+ if (name == null) {
+ throw new InvalidValueException("Attribute 'composite' is missing");
+ }
+ QName compositeName = null;
+
+ int index = name.indexOf(':');
+ if (index != -1) {
+ String prefix = name.substring(0, index);
+ String localPart = name.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ throw new InvalidValueException("Invalid prefix: " + prefix);
+ }
+ compositeName = new QName(targetNameSpaceURI, localPart, prefix);
+ } else {
+ String prefix = "";
+ String localPart = name;
+ compositeName = new QName(targetNameSpaceURI, localPart, prefix);
+ }
+
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(compositeName);
+ composite.setUnresolved(true);
+
+ contribution.getDeployables().add(composite);
+ } else if (IMPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new InvalidValueException("Attribute 'namespace' is missing");
+ }
+ String location = reader.getAttributeValue(null, "location");
+ ContributionImport contributionImport = this.contributionFactory.createContributionImport();
+ if (location != null) {
+ contributionImport.setLocation(location);
+ }
+ contributionImport.setNamespace(ns);
+ contribution.getImports().add(contributionImport);
+ } else if (EXPORT.equals(element)) {
+ String ns = reader.getAttributeValue(null, "namespace");
+ if (ns == null) {
+ throw new InvalidValueException("Attribute 'namespace' is missing");
+ }
+ ContributionExport contributionExport = this.contributionFactory.createContributionExport();
+ contributionExport.setNamespace(ns);
+ contribution.getExports().add(contributionExport);
+ }
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (CONTRIBUTION.equals(reader.getName())) {
+ return;
+ }
+ break;
+
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
new file mode 100644
index 0000000000..e2dc89782d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
@@ -0,0 +1,266 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.impl;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+/**
+ * The default implementation of ContributionRepository
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionRepositoryImpl implements ContributionRepository {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final String DOMAIN_INDEX_FILENAME = "sca-domain.xml";
+ private final File rootFile;
+ private Map<String, String> contributionMap = new HashMap<String, String>();
+
+ private URI domain;
+ private XMLInputFactory factory;
+
+ /**
+ * Constructor with repository root
+ *
+ * @param repository
+ */
+ public ContributionRepositoryImpl(final String repository) throws IOException {
+ String root = repository;
+ if (repository == null) {
+ root = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ // Default to <user.home>/.tuscany/domains/local/
+ String userHome = System.getProperty("user.home");
+ String slash = File.separator;
+ return userHome + slash + ".tuscany" + slash + "domains" + slash + "local" + slash;
+ }
+ });
+ }
+ this.rootFile = new File(root);
+ this.domain = rootFile.toURI();
+ FileHelper.forceMkdir(rootFile);
+ if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
+ throw new IOException("The root is not a directory: " + repository);
+ }
+ factory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ public URI getDomain() {
+ return domain;
+ }
+
+ /**
+ * Resolve contribution location in the repository -> root repository /
+ * contribution file -> contribution group id / artifact id / version
+ *
+ * @param contribution
+ * @return
+ */
+ private File mapToFile(URL sourceURL) {
+ String fileName = FileHelper.toFile(sourceURL).getName();
+ return new File(rootFile, "contributions" + File.separator + fileName);
+ }
+
+ /**
+ * Write a specific source inputstream to a file on disk
+ *
+ * @param source contents of the file to be written to disk
+ * @param target file to be written
+ * @throws IOException
+ */
+ public static void copy(InputStream source, File target) throws IOException {
+ BufferedOutputStream out = null;
+ BufferedInputStream in = null;
+
+ try {
+ out = new BufferedOutputStream(new FileOutputStream(target));
+ in = new BufferedInputStream(source);
+ IOHelper.copy(in, out);
+ } finally {
+ IOHelper.closeQuietly(out);
+ IOHelper.closeQuietly(in);
+ }
+ }
+
+ public URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ FileHelper.forceMkdir(location.getParentFile());
+
+ copy(contributionStream, location);
+
+ // add contribution to repositoryContent
+ URL contributionURL = location.toURL();
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return contributionURL;
+ }
+
+ public URL store(String contribution, URL sourceURL) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ File source = FileHelper.toFile(sourceURL);
+ if (source == null || source.isFile()) {
+ InputStream is = sourceURL.openStream();
+ try {
+ return store(contribution, sourceURL, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ FileHelper.forceMkdir(location);
+ FileHelper.copyDirectory(source, location);
+
+ // add contribution to repositoryContent
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return location.toURL();
+ }
+
+ public URL find(String contribution) {
+ if (contribution == null) {
+ return null;
+ }
+ String location = contributionMap.get(contribution);
+ if (location == null) {
+ return null;
+ }
+ try {
+ return new File(rootFile, location).toURL();
+ } catch (MalformedURLException e) {
+ // Should not happen
+ throw new AssertionError(e);
+ }
+ }
+
+ public void remove(String contribution) {
+ URL contributionURL = this.find(contribution);
+ if (contributionURL != null) {
+ // remove
+ try {
+ FileHelper.forceDelete(FileHelper.toFile(contributionURL));
+ this.contributionMap.remove(contribution);
+ saveMap();
+ } catch (IOException ioe) {
+ // handle file could not be removed
+ }
+ }
+ }
+
+ public List<String> list() {
+ return new ArrayList<String>(contributionMap.keySet());
+ }
+
+ public void init() {
+ File domainFile = new File(rootFile, "sca-domain.xml");
+ if (!domainFile.isFile()) {
+ return;
+ }
+ FileInputStream is;
+ try {
+ is = new FileInputStream(domainFile);
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ try {
+ XMLStreamReader reader = factory.createXMLStreamReader(new InputStreamReader(is, "UTF-8"));
+ while (reader.hasNext()) {
+ switch (reader.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ String name = reader.getName().getLocalPart();
+ if ("domain".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ domain = URI.create(uri);
+ }
+ }
+ if ("contribution".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ String location = reader.getAttributeValue(null, "location");
+ contributionMap.put(uri, location);
+ }
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ } catch (Exception e) {
+ // Ignore
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ private void saveMap() {
+ File domainFile = new File(rootFile, DOMAIN_INDEX_FILENAME);
+ FileOutputStream os = null;
+ try {
+ os = new FileOutputStream(domainFile);
+ PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
+ writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ writer.println("<domain uri=\"" + getDomain() + "\" xmlns=\"" + NS + "\">");
+ for (Map.Entry<String, String> e : contributionMap.entrySet()) {
+ writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
+ }
+ writer.println("</domain>");
+ writer.flush();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } finally {
+ IOHelper.closeQuietly(os);
+ }
+ }
+
+ public void destroy() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
new file mode 100644
index 0000000000..196c9bc15a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
@@ -0,0 +1,332 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+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.concurrent.ConcurrentHashMap;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionMetadataLoaderException;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+/**
+ * Service interface that manages artifacts contributed to a Tuscany runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionServiceImpl implements ContributionService {
+
+ /**
+ * Repository where contributions are stored. Usually set by injection.
+ */
+ private ContributionRepository contributionRepository;
+
+ /**
+ * Registry of available package processors.
+ */
+ private PackageProcessor packageProcessor;
+
+ /**
+ * Registry of available artifact processors
+ */
+
+ private URLArtifactProcessor artifactProcessor;
+
+ /**
+ * xml factory used to create reader instance to load contribution metadata
+ */
+ private XMLInputFactory xmlFactory;
+
+ /**
+ * contribution metadata loader
+ */
+ private ContributionMetadataLoaderImpl contributionLoader;
+
+ /**
+ * Contribution registry This is a registry of processed Contributions indexed by URI
+ */
+ private Map<String, Contribution> contributionRegistry = new ConcurrentHashMap<String, Contribution>();
+
+ /**
+ * Contribution model facotry
+ */
+ private ContributionFactory contributionFactory;
+
+
+ public ContributionServiceImpl(ContributionRepository repository,
+ PackageProcessor packageProcessor,
+ URLArtifactProcessor artifactProcessor,
+ AssemblyFactory assemblyFactory,
+ ContributionFactory contributionFactory,
+ XMLInputFactory xmlFactory) {
+ super();
+ this.contributionRepository = repository;
+ this.packageProcessor = packageProcessor;
+ this.artifactProcessor = artifactProcessor;
+ this.xmlFactory = xmlFactory;
+
+ this.contributionFactory = contributionFactory;
+ this.contributionLoader = new ContributionMetadataLoaderImpl(assemblyFactory, contributionFactory);
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, ModelResolver modelResolver, boolean storeInRepository) throws ContributionException,
+ IOException {
+ if (contributionURI == null) {
+ throw new IllegalArgumentException("URI for the contribution is null");
+ }
+ if (sourceURL == null) {
+ throw new IllegalArgumentException("Source URL for the contribution is null");
+ }
+
+ return addContribution(contributionURI, sourceURL, null, modelResolver, storeInRepository);
+ }
+
+ public Contribution contribute(String contributionURI, URL sourceURL, InputStream input, ModelResolver modelResolver)
+ throws ContributionException, IOException {
+
+ return addContribution(contributionURI, sourceURL, input, modelResolver, true);
+ }
+
+ private Contribution initializeContributionMetadata(URL sourceURL, ModelResolver modelResolver) throws ContributionException {
+ Contribution contributionMetadata = null;
+ URL contributionMetadataURL;
+ URL generatedContributionMetadataURL;
+ InputStream metadataStream = null;
+
+ URL[] clUrls = {sourceURL};
+ URLClassLoader cl = new URLClassLoader(clUrls);
+
+ contributionMetadataURL = cl.getResource(Contribution.SCA_CONTRIBUTION_META);
+ generatedContributionMetadataURL = cl.getResource(Contribution.SCA_CONTRIBUTION_GENERATED_META);
+
+ try {
+ contributionMetadata = this.contributionFactory.createContribution();
+ contributionMetadata.setModelResolver(modelResolver);
+ if (contributionMetadataURL != null || generatedContributionMetadataURL != null) {
+ URL metadataURL = contributionMetadataURL != null ? contributionMetadataURL
+ : generatedContributionMetadataURL;
+
+ try {
+ metadataStream = metadataURL.openStream();
+ XMLStreamReader xmlReader = this.xmlFactory.createXMLStreamReader(metadataStream);
+ this.contributionLoader.load(contributionMetadata, xmlReader);
+
+ } catch (IOException ioe) {
+ throw new InvalidContributionMetadataException(ioe.getMessage(), metadataURL.toExternalForm(), ioe);
+ } catch (XMLStreamException xmle) {
+ throw new InvalidContributionMetadataException(xmle.getMessage(), metadataURL.toExternalForm(),
+ xmle);
+ } catch (ContributionMetadataLoaderException le) {
+ throw new InvalidContributionMetadataException(le.getMessage(), metadataURL.toExternalForm(), le);
+ }
+ }
+ } finally {
+ IOHelper.closeQuietly(metadataStream);
+ metadataStream = null;
+ }
+
+ if (contributionMetadata == null) {
+ contributionMetadata = this.contributionFactory.createContribution();
+ }
+
+ return contributionMetadata;
+
+ }
+
+ public Contribution getContribution(String id) {
+ return this.contributionRegistry.get(id);
+ }
+
+ public void remove(String contribution) throws ContributionException {
+ this.contributionRegistry.remove(contribution);
+ }
+
+ public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
+ DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
+ artifact.setURI(composite.getURI());
+ artifact.setModel(composite);
+
+ contribution.getArtifacts().add(artifact);
+
+ contribution.getDeployables().add(composite);
+ }
+
+ /**
+ * Utility/Helper methods for contribution service
+ */
+
+ /**
+ * Note:
+ *
+ * @param contributionURI ContributionID
+ * @param sourceURL contribution location
+ * @param contributionStream contribution content
+ * @param storeInRepository flag if we store the contribution into the
+ * repository or not
+ * @return the contribution model representing the contribution
+ * @throws IOException
+ * @throws DeploymentException
+ */
+ private Contribution addContribution(String contributionURI,
+ URL sourceURL,
+ InputStream contributionStream,
+ ModelResolver modelResolver,
+ boolean storeInRepository) throws IOException, ContributionException {
+
+ if (contributionStream == null && sourceURL == null) {
+ throw new IllegalArgumentException("The content of the contribution is null");
+ }
+
+ // store the contribution in the contribution repository
+ URL locationURL = sourceURL;
+ if (contributionRepository != null && storeInRepository) {
+ if (contributionStream == null) {
+ locationURL = contributionRepository.store(contributionURI, sourceURL);
+ } else {
+ locationURL = contributionRepository.store(contributionURI, sourceURL, contributionStream);
+ }
+ }
+
+ Contribution contribution = initializeContributionMetadata(locationURL, modelResolver);
+ contribution.setURI(contributionURI.toString());
+ contribution.setLocation(locationURL.toString());
+
+ List<URI> contributionArtifacts = null;
+
+ //NOTE: if a contribution is stored on the repository
+ //the stream would be consumed at this point
+ if (storeInRepository || contributionStream == null) {
+ contributionStream = sourceURL.openStream();
+ try {
+ // process the contribution
+ contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
+ } finally {
+ IOHelper.closeQuietly(contributionStream);
+ contributionStream = null;
+ }
+ } else {
+ // process the contribution
+ contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
+ }
+
+ // Read all artifacts in the contribution
+ processReadPhase(contribution, contributionArtifacts);
+
+ // Resolve them
+ processResolvePhase(contribution);
+
+ // Add all composites under META-INF/sca-deployables to the
+ // list of deployables
+ String prefix = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ for (DeployedArtifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ if (artifact.getURI().startsWith(prefix)) {
+ Composite composite = (Composite)artifact.getModel();
+ if (!contribution.getDeployables().contains(composite)) {
+ contribution.getDeployables().add(composite);
+ }
+ }
+ }
+ }
+
+ // store the contribution on the registry
+ this.contributionRegistry.put(contribution.getURI(), contribution);
+
+ return contribution;
+ }
+
+ /**
+ * This utility method process each artifact and delegates to proper
+ * artifactProcessor to read the model and generate the in-memory representation
+ *
+ * @param contribution
+ * @param artifacts
+ * @throws ContributionException
+ * @throws MalformedURLException
+ */
+ private void processReadPhase(Contribution contribution, List<URI> artifacts) throws ContributionException,
+ MalformedURLException {
+ URL contributionURL = new URL(contribution.getLocation());
+ for (URI a : artifacts) {
+ URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), a);
+ Object model = this.artifactProcessor.read(contributionURL, a, artifactURL);
+
+ if (model != null) {
+ contribution.getModelResolver().addModel(model);
+
+ DeployedArtifact artifact = this.contributionFactory.createDeployedArtifact();
+ artifact.setURI(a.toString());
+ artifact.setLocation(artifactURL.toString());
+ artifact.setModel(model);
+ contribution.getArtifacts().add(artifact);
+ }
+ }
+ }
+
+ /**
+ * This utility method process each artifact and delegates to proper
+ * artifactProcessor to resolve the model references
+ *
+ * @param contribution
+ * @throws ContributionException
+ */
+ @SuppressWarnings("unchecked")
+ private void processResolvePhase(Contribution contribution) throws ContributionException {
+ // for each artifact that was processed on the contribution
+ for (DeployedArtifact artifact : contribution.getArtifacts()) {
+ // resolve the model object
+ if (artifact.getModel() != null) {
+ this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
+ }
+ }
+
+ //resolve deployables from contribution metadata
+ List<Composite> resolvedDeployables = new ArrayList<Composite>();
+ for (Composite deployableComposite : contribution.getDeployables()) {
+ Composite resolvedDeployable = contribution.getModelResolver().resolveModel(Composite.class, deployableComposite);
+ resolvedDeployables.add(resolvedDeployable);
+ }
+
+ contribution.getDeployables().clear();
+ contribution.getDeployables().addAll(resolvedDeployables);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java
new file mode 100644
index 0000000000..a7e0e2f2f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.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.contribution.service.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ * @version $Rev: 511466 $ $Date: 2007-02-25 00:45:22 -0800 (Sun, 25 Feb 2007) $
+ */
+public class InvalidContributionMetadataException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3184477070625689942L;
+
+ protected InvalidContributionMetadataException() {
+ }
+
+ protected InvalidContributionMetadataException(String message) {
+ super(message);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected InvalidContributionMetadataException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected InvalidContributionMetadataException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java
new file mode 100644
index 0000000000..e3109e795b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.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.contribution.service.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied contribution URI is invalid or inexistent.
+ *
+ * @version $Rev: 511466 $ $Date: 2007-02-25 00:45:22 -0800 (Sun, 25 Feb 2007) $
+ */
+public class InvalidContributionURIException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3184477070625689942L;
+
+ protected InvalidContributionURIException() {
+ }
+
+ protected InvalidContributionURIException(String message) {
+ super(message);
+ }
+
+ protected InvalidContributionURIException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected InvalidContributionURIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidContributionURIException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected InvalidContributionURIException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidValueException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidValueException.java
new file mode 100644
index 0000000000..ce0fb59476
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidValueException.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.contribution.service.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionMetadataLoaderException;
+
+/**
+ * Denotate invalid value found during parsing of the contribution metadata sidefile
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidValueException extends ContributionMetadataLoaderException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1447696740893397938L;
+
+ public InvalidValueException(String message) {
+ super(message);
+ }
+
+ public InvalidValueException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidValueException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java
new file mode 100644
index 0000000000..165c9d0616
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.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.contribution.service.impl;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+/**
+ * Implementation of the content describer for contribution packages
+ *
+ * @version $Rev$ $Date$
+ */
+public class PackageTypeDescriberImpl implements TypeDescriber {
+ private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
+
+ public PackageTypeDescriberImpl() {
+ super();
+ init();
+ }
+
+ /**
+ * Initialize contentType registry with know types based on known file extensions
+ */
+ private void init() {
+ contentTypeRegistry.put("JAR", ContentType.JAR);
+ }
+
+ protected String resolveContentyTypeByExtension(URL resourceURL) {
+ String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
+ if (artifactExtension == null) {
+ return null;
+ }
+ return contentTypeRegistry.get(artifactExtension.toUpperCase());
+ }
+
+ /**
+ * Build contentType for a specific resource. We first check if the file is
+ * a supported one (looking into our registry based on resource extension)
+ * If not found, we try to check file contentType Or we return
+ * defaultContentType provided
+ *
+ * @param resourceURL The artifact url
+ * @param defaultContentType The default content type if we can't find the correc one
+ * @return The content type
+ */
+ public String getType(URL resourceURL, String defaultContentType) {
+ URLConnection connection = null;
+ String contentType = defaultContentType;
+
+ if (resourceURL.getProtocol().equals("file") && FileHelper.toFile(resourceURL).isDirectory()) {
+ // Special case : contribution is a folder
+ contentType = ContentType.FOLDER;
+ } else {
+ contentType = resolveContentyTypeByExtension(resourceURL);
+ if (contentType == null) {
+ try {
+ connection = resourceURL.openConnection();
+ contentType = connection.getContentType();
+
+ if (contentType == null || contentType.equals("content/unknown")) {
+ // here we couldn't figure out from our registry or from URL and it's not a special file
+ // return defaultContentType if provided
+ contentType = defaultContentType;
+ }
+ } catch (IOException io) {
+ // could not access artifact, just ignore and we will return
+ // null contentType
+ }
+ }
+ }
+ return contentType == null ? defaultContentType : contentType;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
new file mode 100644
index 0000000000..bc63dca4a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
@@ -0,0 +1,704 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.service.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.regex.Pattern;
+
+public class FileHelper {
+ /**
+ * The extension separator character.
+ */
+ private static final char EXTENSION_SEPARATOR = '.';
+
+ /**
+ * The Unix separator character.
+ */
+ private static final char UNIX_SEPARATOR = '/';
+
+ /**
+ * The Windows separator character.
+ */
+ private static final char WINDOWS_SEPARATOR = '\\';
+
+ protected FileHelper() {
+ }
+
+ /**
+ * Returns the index of the last directory separator character.
+ * <p>
+ * This method will handle a file in either Unix or Windows format. The
+ * position of the last forward or backslash is returned.
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to find the last path separator in, null
+ * returns -1
+ * @return the index of the last separator character, or -1 if there is no
+ * such character
+ */
+ public static int indexOfLastSeparator(String filename) {
+ if (filename == null) {
+ return -1;
+ }
+ int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR);
+ int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR);
+ return Math.max(lastUnixPos, lastWindowsPos);
+ }
+
+ /**
+ * Returns the index of the last extension separator character, which is a
+ * dot.
+ * <p>
+ * This method also checks that there is no directory separator after the
+ * last dot. To do this it uses {@link #indexOfLastSeparator(String)} which
+ * will handle a file in either Unix or Windows format.
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to find the last path separator in, null
+ * returns -1
+ * @return the index of the last separator character, or -1 if there is no
+ * such character
+ */
+ public static int indexOfExtension(String filename) {
+ if (filename == null) {
+ return -1;
+ }
+ int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR);
+ int lastSeparator = indexOfLastSeparator(filename);
+ return lastSeparator > extensionPos ? -1 : extensionPos;
+ }
+
+ /**
+ * Gets the name minus the path from a full filename.
+ * <p>
+ * This method will handle a file in either Unix or Windows format. The text
+ * after the last forward or backslash is returned.
+ *
+ * <pre>
+ * a/b/c.txt --&gt; c.txt
+ * a.txt --&gt; a.txt
+ * a/b/c --&gt; c
+ * a/b/c/ --&gt; &quot;&quot;
+ * </pre>
+ *
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param fileName the filename to query, null returns null
+ * @return the name of the file without the path, or an empty string if none
+ * exists
+ */
+ public static String getName(String fileName) {
+ if (fileName == null) {
+ return null;
+ }
+ int index = indexOfLastSeparator(fileName);
+ return fileName.substring(index + 1);
+ }
+
+ /**
+ * Gets the extension of a filename.
+ * <p>
+ * This method returns the textual part of the filename after the last dot.
+ * There must be no directory separator after the dot.
+ *
+ * <pre>
+ * foo.txt --&gt; &quot;txt&quot;
+ * a/b/c.jpg --&gt; &quot;jpg&quot;
+ * a/b.txt/c --&gt; &quot;&quot;
+ * a/b/c --&gt; &quot;&quot;
+ * </pre>
+ *
+ * <p>
+ * The output will be the same irrespective of the machine that the code is
+ * running on.
+ *
+ * @param filename the filename to retrieve the extension of.
+ * @return the extension of the file or an empty string if none exists.
+ */
+ public static String getExtension(String filename) {
+ if (filename == null) {
+ return null;
+ }
+ int index = indexOfExtension(filename);
+ if (index == -1) {
+ return "";
+ } else {
+ return filename.substring(index + 1);
+ }
+ }
+
+ /**
+ * Make a directory, including any necessary but nonexistent parent
+ * directories. If there already exists a file with specified name or the
+ * directory cannot be created then an exception is thrown.
+ *
+ * @param directory directory to create, not null
+ * @throws NullPointerException if the directory is null
+ * @throws IOException if the directory cannot be created
+ */
+ public static void forceMkdir(File directory) throws IOException {
+ if (directory.exists()) {
+ if (directory.isFile()) {
+ String message =
+ "File " + directory + " exists and is " + "not a directory. Unable to create directory.";
+ throw new IOException(message);
+ }
+ } else {
+ if (!directory.mkdirs()) {
+ String message = "Unable to create directory " + directory;
+ throw new IOException(message);
+ }
+ }
+ }
+
+ /**
+ * Delete a file. If file is a directory, delete it and all sub-directories.
+ * <p>
+ * The difference between File.delete() and this method are:
+ * <ul>
+ * <li>A directory to be deleted does not have to be empty.</li>
+ * <li>You get exceptions when a file or directory cannot be deleted.
+ * (java.io.File methods returns a boolean)</li>
+ * </ul>
+ *
+ * @param file file or directory to delete, not null
+ * @throws NullPointerException if the directory is null
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void forceDelete(File file) throws IOException {
+ if (file.isDirectory()) {
+ deleteDirectory(file);
+ } else {
+ if (!file.exists()) {
+ throw new FileNotFoundException("File does not exist: " + file);
+ }
+ if (!file.delete()) {
+ String message = "Unable to delete file: " + file;
+ throw new IOException(message);
+ }
+ }
+ }
+
+ /**
+ * Convert from a <code>URL</code> to a <code>File</code>.
+ * <p>
+ * From version 1.1 this method will decode the URL. Syntax such as
+ * <code>file:///my%20docs/file.txt</code> will be correctly decoded to
+ * <code>/my docs/file.txt</code>.
+ *
+ * @param url the file URL to convert, null returns null
+ * @return the equivalent <code>File</code> object, or <code>null</code>
+ * if the URL's protocol is not <code>file</code>
+ * @throws IllegalArgumentException if the file is incorrectly encoded
+ */
+ public static File toFile(URL url) {
+ if (url == null || !url.getProtocol().equals("file")) {
+ return null;
+ } else {
+ String filename = url.getFile().replace('/', File.separatorChar);
+ int pos = 0;
+ while ((pos = filename.indexOf('%', pos)) >= 0) { // NOPMD
+ if (pos + 2 < filename.length()) {
+ String hexStr = filename.substring(pos + 1, pos + 3);
+ char ch = (char)Integer.parseInt(hexStr, 16);
+ filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
+ }
+ }
+ return new File(filename);
+ }
+ }
+
+ public static FileFilter getFileFilter(String regExp, boolean ignoreCase) {
+ return new RegExpFilter(regExp, ignoreCase);
+ }
+
+ /**
+ * A regular-expression based resource filter
+ */
+ public static class RegExpFilter implements FileFilter {
+ private Pattern pattern;
+
+ public RegExpFilter(Pattern pattern) {
+ this.pattern = pattern;
+ }
+
+ public RegExpFilter(String patternStr, boolean ignoreCase) {
+ this.pattern = Pattern.compile(patternStr, ignoreCase ? Pattern.CASE_INSENSITIVE : 0);
+ }
+
+ public boolean accept(File file) {
+ return pattern.matcher(file.getName()).matches();
+ }
+
+ /**
+ * Convert wildcard into a regex pattern
+ *
+ * @param str
+ * @return
+ */
+ public static RegExpFilter getWildcardFilter(String str, boolean ignoreCase) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < str.length(); i++) {
+ char ch = str.charAt(i);
+ if (ch == '?') {
+ buffer.append('.');
+ } else if (ch == '*') {
+ buffer.append(".*");
+ } else {
+ buffer.append(ch);
+ }
+ }
+ return new RegExpFilter(buffer.toString(), ignoreCase);
+ }
+
+ }
+
+ /**
+ * Clean a directory without deleting it.
+ *
+ * @param directory directory to clean
+ * @throws IOException in case cleaning is unsuccessful
+ */
+ public static void cleanDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ String message = directory + " does not exist";
+ throw new IllegalArgumentException(message);
+ }
+
+ if (!directory.isDirectory()) {
+ String message = directory + " is not a directory";
+ throw new IllegalArgumentException(message);
+ }
+
+ File[] files = directory.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + directory);
+ }
+
+ IOException exception = null;
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ try {
+ forceDelete(file);
+ } catch (IOException ioe) {
+ exception = ioe;
+ }
+ }
+
+ if (null != exception) {
+ throw exception;
+ }
+ }
+
+ /**
+ * Clean a directory without deleting it.
+ *
+ * @param directory directory to clean, must not be <code>null</code>
+ * @throws NullPointerException if the directory is <code>null</code>
+ * @throws IOException in case cleaning is unsuccessful
+ */
+ private static void cleanDirectoryOnExit(File directory) throws IOException {
+ if (!directory.exists()) {
+ String message = directory + " does not exist";
+ throw new IllegalArgumentException(message);
+ }
+
+ if (!directory.isDirectory()) {
+ String message = directory + " is not a directory";
+ throw new IllegalArgumentException(message);
+ }
+
+ File[] files = directory.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + directory);
+ }
+
+ IOException exception = null;
+ for (int i = 0; i < files.length; i++) {
+ File file = files[i];
+ try {
+ forceDeleteOnExit(file);
+ } catch (IOException ioe) {
+ exception = ioe;
+ }
+ }
+
+ if (null != exception) {
+ throw exception;
+ }
+ }
+
+ /**
+ * Copies a whole directory to a new location preserving the file dates.
+ * <p>
+ * This method copies the specified directory and all its child directories
+ * and files to the specified destination. The destination is the new
+ * location and name of the directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the new directory, must not be <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.1
+ */
+ public static void copyDirectory(File srcDir, File destDir) throws IOException {
+ copyDirectory(srcDir, destDir, true);
+ }
+
+ /**
+ * Copies a whole directory to a new location.
+ * <p>
+ * This method copies the contents of the specified source directory to
+ * within the specified destination directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the new directory, must not be <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.1
+ */
+ public static void copyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
+ if (srcDir == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!srcDir.exists()) {
+ throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
+ }
+ if (!srcDir.isDirectory()) {
+ throw new IOException("Source '" + srcDir + "' exists but is not a directory");
+ }
+ if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) {
+ throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same");
+ }
+ doCopyDirectory(srcDir, destDir, preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Copies a directory to within another directory preserving the file dates.
+ * <p>
+ * This method copies the source directory and all its contents to a
+ * directory of the same name in the specified destination directory.
+ * <p>
+ * The destination directory is created if it does not exist. If the
+ * destination directory did exist, then this method merges the source with
+ * the destination, with the source taking precedence.
+ *
+ * @param srcDir an existing directory to copy, must not be
+ * <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @since Commons IO 1.2
+ */
+ public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException {
+ if (srcDir == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (!(srcDir.exists() && srcDir.isDirectory())) {
+ throw new IllegalArgumentException("Source '" + destDir + "' is not a directory");
+ }
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!(destDir.exists() && destDir.isDirectory())) {
+ throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
+ }
+ copyDirectory(srcDir, new File(destDir, srcDir.getName()), true);
+ }
+
+ /**
+ * Copies a file to a new location preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to the
+ * specified destination file. The directory holding the destination file is
+ * created if it does not exist. If the destination file exists, then this
+ * method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destFile the new file, must not be <code>null</code>
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFileToDirectory(File, File)
+ */
+ public static void copyFile(File srcFile, File destFile) throws IOException {
+ copyFile(srcFile, destFile, true);
+ }
+
+ /**
+ * Copies a file to a new location.
+ * <p>
+ * This method copies the contents of the specified source file to the
+ * specified destination file. The directory holding the destination file is
+ * created if it does not exist. If the destination file exists, then this
+ * method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destFile the new file, must not be <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFileToDirectory(File, File, boolean)
+ */
+ public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
+ if (srcFile == null) {
+ throw new NullPointerException("Source must not be null");
+ }
+ if (destFile == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!srcFile.exists()) {
+ throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
+ }
+ if (srcFile.isDirectory()) {
+ throw new IOException("Source '" + srcFile + "' exists but is a directory");
+ }
+ if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) {
+ throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same");
+ }
+ if (!(destFile.getParentFile() != null && destFile.getParentFile().exists())) {
+ if (!destFile.getParentFile().mkdirs()) { //NOPMD
+ throw new IOException("Destination '" + destFile + "' directory cannot be created");
+ }
+ }
+ if (!(destFile.exists() && destFile.canWrite())) {
+ throw new IOException("Destination '" + destFile + "' exists but is read-only");
+ }
+ doCopyFile(srcFile, destFile, preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Copies a file to a directory preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to a file of
+ * the same name in the specified destination directory. The destination
+ * directory is created if it does not exist. If the destination file
+ * exists, then this method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @throws NullPointerException if source or destination is null
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFile(File, File, boolean)
+ */
+ public static void copyFileToDirectory(File srcFile, File destDir) throws IOException {
+ copyFileToDirectory(srcFile, destDir, true);
+ }
+
+ /**
+ * Copies a file to a directory optionally preserving the file date.
+ * <p>
+ * This method copies the contents of the specified source file to a file of
+ * the same name in the specified destination directory. The destination
+ * directory is created if it does not exist. If the destination file
+ * exists, then this method will overwrite it.
+ *
+ * @param srcFile an existing file to copy, must not be <code>null</code>
+ * @param destDir the directory to place the copy in, must not be
+ * <code>null</code>
+ * @param preserveFileDate true if the file date of the copy should be the
+ * same as the original
+ * @throws NullPointerException if source or destination is
+ * <code>null</code>
+ * @throws IOException if source or destination is invalid
+ * @throws IOException if an IO error occurs during copying
+ * @see #copyFile(File, File, boolean)
+ * @since Commons IO 1.3
+ */
+ public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
+ if (destDir == null) {
+ throw new NullPointerException("Destination must not be null");
+ }
+ if (!(destDir.exists() && destDir.isDirectory())) {
+ throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
+ }
+ copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate);
+ }
+
+ // -----------------------------------------------------------------------
+ /**
+ * Recursively delete a directory.
+ *
+ * @param directory directory to delete
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void deleteDirectory(File directory) throws IOException {
+ if (!directory.exists()) {
+ return;
+ }
+
+ cleanDirectory(directory);
+ if (!directory.delete()) {
+ String message = "Unable to delete directory " + directory + ".";
+ throw new IOException(message);
+ }
+ }
+
+ /**
+ * Recursively schedule directory for deletion on JVM exit.
+ *
+ * @param directory directory to delete, must not be <code>null</code>
+ * @throws NullPointerException if the directory is <code>null</code>
+ * @throws IOException in case deletion is unsuccessful
+ */
+ private static void deleteDirectoryOnExit(File directory) throws IOException {
+ if (!directory.exists()) {
+ return;
+ }
+
+ cleanDirectoryOnExit(directory);
+ directory.deleteOnExit();
+ }
+
+ /**
+ * Internal copy directory method.
+ *
+ * @param srcDir the validated source directory, must not be
+ * <code>null</code>
+ * @param destDir the validated destination directory, must not be
+ * <code>null</code>
+ * @param preserveFileDate whether to preserve the file date
+ * @throws IOException if an error occurs
+ * @since Commons IO 1.1
+ */
+ private static void doCopyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
+ if (destDir.exists()) {
+ if (!destDir.isDirectory()) {
+ throw new IOException("Destination '" + destDir + "' exists but is not a directory");
+ }
+ } else {
+ if (!destDir.mkdirs()) {
+ throw new IOException("Destination '" + destDir + "' directory cannot be created");
+ }
+ if (preserveFileDate) {
+ destDir.setLastModified(srcDir.lastModified());
+ }
+ }
+ if (!destDir.canWrite()) {
+ throw new IOException("Destination '" + destDir + "' cannot be written to");
+ }
+ // recurse
+ File[] files = srcDir.listFiles();
+ if (files == null) { // null if security restricted
+ throw new IOException("Failed to list contents of " + srcDir);
+ }
+ for (int i = 0; i < files.length; i++) {
+ File copiedFile = new File(destDir, files[i].getName());
+ if (files[i].isDirectory()) {
+ doCopyDirectory(files[i], copiedFile, preserveFileDate);
+ } else {
+ doCopyFile(files[i], copiedFile, preserveFileDate);
+ }
+ }
+ }
+
+ /**
+ * Internal copy file method.
+ *
+ * @param srcFile the validated source file, must not be <code>null</code>
+ * @param destFile the validated destination file, must not be
+ * <code>null</code>
+ * @param preserveFileDate whether to preserve the file date
+ * @throws IOException if an error occurs
+ */
+ private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
+ if (destFile.exists() && destFile.isDirectory()) {
+ throw new IOException("Destination '" + destFile + "' exists but is a directory");
+ }
+
+ FileInputStream input = new FileInputStream(srcFile);
+ try {
+ FileOutputStream output = new FileOutputStream(destFile);
+ try {
+ IOHelper.copy(input, output);
+ } finally {
+ IOHelper.closeQuietly(output);
+ }
+ } finally {
+ IOHelper.closeQuietly(input);
+ }
+
+ if (srcFile.length() != destFile.length()) {
+ throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
+ }
+ if (preserveFileDate) {
+ destFile.setLastModified(srcFile.lastModified());
+ }
+ }
+
+ /**
+ * Schedule a file to be deleted when JVM exits. If file is directory delete
+ * it and all sub-directories.
+ *
+ * @param file file or directory to delete, must not be <code>null</code>
+ * @throws NullPointerException if the file is <code>null</code>
+ * @throws IOException in case deletion is unsuccessful
+ */
+ public static void forceDeleteOnExit(File file) throws IOException {
+ if (file.isDirectory()) {
+ deleteDirectoryOnExit(file);
+ } else {
+ file.deleteOnExit();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
new file mode 100644
index 0000000000..f8ea93ae5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.contribution.service.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+public class IOHelper {
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ protected IOHelper() {
+
+ }
+
+ /**
+ * Unconditionally close an <code>InputStream</code>.
+ * <p>
+ * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param input the InputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(InputStream input) {
+ try {
+ if (input != null) {
+ input.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Unconditionally close an <code>OutputStream</code>.
+ * <p>
+ * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param output the OutputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(OutputStream output) {
+ try {
+ if (output != null) {
+ output.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Copy bytes from an <code>InputStream</code> to an
+ * <code>OutputStream</code>.
+ * <p>
+ * This method buffers the input internally, so there is no need to use a
+ * <code>BufferedInputStream</code>.
+ *
+ * @param input the <code>InputStream</code> to read from
+ * @param output the <code>OutputStream</code> to write to
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since Commons IO 1.1
+ */
+ public static int copy(InputStream input, OutputStream output) throws IOException {
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ int count = 0;
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) { // NOPMD
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ return count;
+ }
+
+ public static InputStream getInputStream(URL url) throws IOException {
+ return new SafeURLInputStream(url);
+ }
+
+ /**
+ * This class is a workaround for URL stream issue as illustrated below.
+ * InputStream is=url.getInputStream(); is.close(); // This line doesn't close
+ * the JAR file if the URL is a jar entry like "jar:file:/a.jar!/my.composite" We
+ * also need to turn off the JarFile cache.
+ *
+ * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4950148
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class SafeURLInputStream extends InputStream {
+ private JarFile jarFile;
+ private InputStream is;
+
+ public SafeURLInputStream(URL url) throws IOException {
+ String protocol = url.getProtocol();
+ if (protocol != null && (protocol.equals("jar"))) {
+ JarURLConnection connection = (JarURLConnection)url.openConnection();
+ // We cannot use cache
+ connection.setUseCaches(false);
+ try {
+ is = connection.getInputStream();
+ } catch (IOException e) {
+ throw e;
+ }
+ jarFile = connection.getJarFile();
+ } else {
+ is = url.openStream();
+ }
+ }
+
+ public SafeURLInputStream(JarURLConnection connection) throws IOException {
+ // We cannot use cache
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ jarFile = connection.getJarFile();
+ }
+
+ public int available() throws IOException {
+ return is.available();
+ }
+
+ public void close() throws IOException {
+ is.close();
+ // We need to close the JAR file
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ public synchronized void mark(int readlimit) {
+ is.mark(readlimit);
+ }
+
+ public boolean markSupported() {
+ return is.markSupported();
+ }
+
+ public int read() throws IOException {
+ return is.read();
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ return is.read(b, off, len);
+ }
+
+ public int read(byte[] b) throws IOException {
+ return is.read(b);
+ }
+
+ public synchronized void reset() throws IOException {
+ is.reset();
+ }
+
+ public long skip(long n) throws IOException {
+ return is.skip(n);
+ }
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..6a2f2ac3cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.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.contribution.processor;
+
+import java.io.File;
+import java.net.URI;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+
+public class FolderContributionPackageProcessorTestCase extends TestCase {
+ private static final String FOLDER_CONTRIBUTION = ".";
+
+ private File contributionRoot;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.contributionRoot = new File(FOLDER_CONTRIBUTION);
+ }
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
+
+ List<URI> artifacts = folderProcessor.getArtifacts(contributionRoot.toURL(), null);
+ assertNotNull(artifacts);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
new file mode 100644
index 0000000000..8765423dbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.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.contribution.processor;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+public class JarContributionPackageProcessorTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ JarContributionProcessor jarProcessor = new JarContributionProcessor();
+
+ URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
+ InputStream jarStream = jarURL.openStream();
+ List<URI> artifacts = null;
+ try {
+ artifacts = jarProcessor.getArtifacts(jarURL, jarStream);
+ } finally {
+ IOHelper.closeQuietly(jarStream);
+ }
+
+ assertNotNull(artifacts);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ArtifactResolverTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ArtifactResolverTestCase.java
new file mode 100644
index 0000000000..ef0fd892c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ArtifactResolverTestCase.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.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+
+/**
+ * Test DefaultArtifactResolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArtifactResolverTestCase extends TestCase {
+
+ private ModelResolver resolver;
+
+ protected void setUp() throws Exception {
+ resolver = new ModelResolverImpl(getClass().getClassLoader());
+ }
+
+ protected void tearDown() throws Exception {
+ resolver = null;
+ }
+
+ public void testResolved() {
+ Model a = new Model("a");
+ resolver.addModel(a);
+ Model x = new Model("a");
+ x = resolver.resolveModel(Model.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testUnresolved() {
+ Model x = new Model("a");
+ Model y = resolver.resolveModel(Model.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testResolveClass() {
+ ClassReference ref = new ClassReference(getClass().getName());
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.getJavaClass() == getClass());
+ }
+
+ public void testUnresolvedClass() {
+ ClassReference ref = new ClassReference("NonExistentClass");
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == null);
+ }
+
+
+
+ class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java
new file mode 100644
index 0000000000..4f924225ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.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.sca.contribution.services;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.service.impl.ArtifactTypeDescriberImpl;
+
+public class ContentTypeDescriberImplTestCase extends TestCase {
+ private ArtifactTypeDescriberImpl contentTypeDescriber;
+
+ public void testResolveContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.composite");
+ assertEquals(ContentType.COMPOSITE, contentTypeDescriber.getType(artifactURL, null));
+ }
+
+
+ public void testResolveUnknownContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertNull(contentTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testDefaultContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertEquals("application/vnd.tuscany.ext",
+ contentTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ contentTypeDescriber = new ArtifactTypeDescriberImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataLoaderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataLoaderTestCase.java
new file mode 100644
index 0000000000..ac1d968f39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataLoaderTestCase.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.sca.contribution.services;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionMetadataLoaderImpl;
+import org.apache.tuscany.sca.contribution.service.impl.InvalidValueException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataLoaderTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns:Composite2\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns3:Composite1\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ public void testLoad() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+
+ ContributionFactory factory = new ContributionFactoryImpl();
+ ContributionMetadataLoaderImpl loader =
+ new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
+ Contribution contribution = factory.createContribution();
+ contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+ loader.load(contribution, reader);
+ assertNotNull(contribution);
+ assertEquals(1, contribution.getImports().size());
+ assertEquals(1, contribution.getExports().size());
+ assertEquals(2, contribution.getDeployables().size());
+ }
+
+ public void testLoadInvalid() throws Exception {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+ ContributionFactory factory = new ContributionFactoryImpl();
+ ContributionMetadataLoaderImpl loader =
+ new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
+ Contribution contribution = factory.createContribution();
+ contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+ try {
+ loader.load(contribution, reader);
+ fail("InvalidException should have been thrown");
+ } catch (InvalidValueException e) {
+ assertTrue(true);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
new file mode 100644
index 0000000000..98f69b9aa1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.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.contribution.services;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+public class ContributionRepositoryTestCase extends TestCase {
+ private ContributionRepositoryImpl repository;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ // create repository (this should re-create the root directory)
+ this.repository = new ContributionRepositoryImpl("target/repository/");
+ repository.init();
+ }
+
+ public void testStore() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ URL contributionURL = repository.find(contribution);
+ assertNotNull(contributionURL);
+ }
+
+ public void testRemove() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ repository.remove(contribution);
+ URL contributionURL = repository.find(contribution);
+ assertNull(contributionURL);
+ }
+
+ public void testList() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ assertEquals(1, repository.list().size());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ FileHelper.deleteDirectory(new File("target/repository"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java
new file mode 100644
index 0000000000..7ee873b9a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.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.contribution.services;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+
+public class PackageTypeDescriberImplTestCase extends TestCase {
+ private PackageTypeDescriberImpl packageTypeDescriber;
+
+ public void testResolvePackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/deployables/sample-calculator.jar");
+ assertEquals(ContentType.JAR, this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testResolveUnknownPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertNull(this.packageTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testDefaultPackageType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertEquals("application/vnd.tuscany.ext",
+ packageTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ packageTypeDescriber = new PackageTypeDescriberImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
new file mode 100644
index 0000000000..0ca3a1b781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
new file mode 100644
index 0000000000..9c46c679d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.composite b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.composite
new file mode 100644
index 0000000000..1e09549194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.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>
+ This file just needs to exist
+</composite> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.ext b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.ext
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution-impl/src/test/resources/test.ext
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.pmd
new file mode 100644
index 0000000000..84af2f4d5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.ruleset
new file mode 100644
index 0000000000..ac8671859d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/.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/sca-java-1.x/branches/sca-java-0.90/modules/contribution/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/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/sca-java-1.x/branches/sca-java-0.90/modules/contribution/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/pom.xml
new file mode 100644
index 0000000000..9adccbb90c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-contribution</artifactId>
+ <name>Apache Tuscany SCA Contribution Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
new file mode 100644
index 0000000000..c57054cfd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.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.contribution;
+
+
+/**
+ * Base Artifact interface to accomodate common properties between Contribution and Deployed Artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Artifact {
+ /**
+ * Get the URI that unique identifies the artifact
+ *
+ * @return The artifact uri
+ */
+ String getURI();
+
+ /**
+ * Set the URI that unique identifies the artifact
+ *
+ * @param uri The artifact uri
+ */
+ void setURI(String uri);
+
+ /**
+ * Get the URL location for the artifact
+ *
+ * @return The artifact location
+ */
+ String getLocation();
+
+ /**
+ * Set the URL location for the artifact
+ *
+ * @param location The artifact location
+ */
+ void setLocation(String location);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java
new file mode 100644
index 0000000000..2e9eb203ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.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.contribution;
+
+/**
+ * Identifies internal content types for contribution package and artifacts
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContentType {
+ /**
+ * Java compressed contribution package
+ */
+ String JAR = "application/x-compressed";
+ /**
+ * Filesystem folder contribution package
+ */
+ String FOLDER = "application/vnd.tuscany.folder";
+ /**
+ * Contribution metadata file
+ */
+ String CONTRIBUTION_METADATA = "application/vnd.tuscany.contribution.metadata";
+ /**
+ * SCA Composite description file
+ */
+ String COMPOSITE = "application/vnd.tuscany.composite";
+ /**
+ * WSDL file
+ */
+ String WSDL = "application/vnd.tuscany.wsdl";
+ /**
+ * Java source/binary file
+ */
+ String JAVA = "application/java-vm";
+ /**
+ * Unkown contentType
+ */
+ String UNKNOWN = "content/unknown";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
new file mode 100644
index 0000000000..4775fba4e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.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.contribution;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of a deployed contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Contribution extends Artifact {
+ /**
+ * Default location of contribution metadata in a contribution package
+ */
+ String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
+ /**
+ * default location of a generated contribution metadata in a contribution package
+ */
+ String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
+ /**
+ * Default location of deployables in a contribution
+ */
+ String SCA_CONTRIBUTION_DEPLOYABLES = "META-INF/sca-deployables/";
+
+
+ /**
+ * Get a list of exports based on the Contribution metadata sidefile
+ *
+ * @return The list of exported artifacts from this contribution
+ */
+ List<ContributionExport> getExports();
+
+ /**
+ * Get a list of imports based on the Contribution metadata sidefile
+ *
+ * @return The list of imported artifacts on this contribution
+ */
+ List<ContributionImport> getImports();
+
+ /**
+ * Get a list of deployables for the contribution based on the contribution metadata sidefile
+ *
+ * @return The list of deployable composites
+ */
+ List<Composite> getDeployables();
+
+ /**
+ * Get a list of artifacts from the contribution
+ *
+ * @return The list of deployed artifacts for the contribution
+ */
+ List<DeployedArtifact> getArtifacts();
+
+ /**
+ * Returns the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing the artifacts
+ * visible in the scope of this contribution.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionExport.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionExport.java
new file mode 100644
index 0000000000..914788a8c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionExport.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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * The representation of an export for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionExport {
+
+ /**
+ * Get Namespace that identifies the export
+ *
+ * @return The exported namespace
+ */
+ String getNamespace();
+
+ /**
+ * Set Namespace that identifies the export
+ *
+ * @param namespace The exported namespace
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this export.
+ *
+ * @param modelResolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
new file mode 100644
index 0000000000..8e1ce6e8ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.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.contribution;
+
+/**
+ * Contribution model object factory
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionFactory {
+ /**
+ * Create a contribution model object
+ *
+ * @return The new contribution model object
+ */
+ Contribution createContribution();
+
+ /**
+ * Create a deployedArtifact model object
+ *
+ * @return The new deployedArtifact model object
+ */
+ DeployedArtifact createDeployedArtifact();
+
+ /**
+ * Create a contribution import model
+ *
+ * @return The new ContributionImport model object
+ */
+ ContributionImport createContributionImport();
+
+ /**
+ * Create a contribution import model
+ *
+ * @return The new ContributoinExport object
+ */
+ ContributionExport createContributionExport();
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionImport.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionImport.java
new file mode 100644
index 0000000000..e42d65947b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionImport.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.contribution;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * The representation of an import for the contribution
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionImport {
+
+ /**
+ * Get the location used to resolve the definitions for this import
+ *
+ * @return The import location
+ */
+ String getLocation();
+
+ /**
+ * Set the location used to resolve the definitions for this import
+ *
+ * @param location The import location
+ */
+ void setLocation(String location);
+
+ /**
+ * Get Namespace that identifies the import
+ *
+ * @return The namespace
+ */
+ String getNamespace();
+
+ /**
+ * Set Namespace that identifies the import
+ *
+ * @param namespace The namespace
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @return The model resolver
+ */
+ ModelResolver getModelResolver();
+
+ /**
+ * Sets the model resolver for the models representing artifacts
+ * made available by this import.
+ *
+ * @param modelResolver The model resolver
+ */
+ void setModelResolver(ModelResolver modelResolver);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
new file mode 100644
index 0000000000..4b0fb1cc08
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.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.contribution;
+
+/**
+ * Representation of a deployed artifact
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DeployedArtifact extends Artifact {
+
+ /**
+ * Get the assembly model associated with this artifact
+ *
+ * @return The assembly model
+ */
+ Object getModel();
+
+ /**
+ * Set the assembly model associated with this artifact
+ *
+ * @param modelObject The assembly model
+ */
+ void setModel(Object modelObject);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
new file mode 100644
index 0000000000..014c187733
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.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.contribution.processor;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * Interface for extensions that can process contributions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactProcessor<M> {
+
+ /**
+ * Resolve references from this model to other models. For example references
+ * from a composite to another one, or references from a composite to a WSDL
+ * model.
+ *
+ * @param model The model to resolve
+ * @param resolver The resolver to use to resolve referenced models
+ */
+ void resolve(M model, ModelResolver resolver) throws ContributionResolveException;
+
+ /**
+ * Returns the type of model handled by this artifact processor.
+ *
+ * @return The type of model handled by this artifact processor
+ */
+ Class<M> getModelType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..029df61f0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * An extension point for artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ArtifactProcessorExtensionPoint<P extends ArtifactProcessor> {
+
+ /**
+ * Add an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to add
+ */
+ void addArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Remove an artifact processor.
+ *
+ * @param artifactProcessor The artifact processor to remove
+ */
+ void removeArtifactProcessor(P artifactProcessor);
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ *
+ * @param artifactType An artifact type
+ * @return The processor associated with the given artifact type
+ */
+ P getProcessor(Object artifactType);
+
+ /**
+ * Returns the processor associated with the given model type.
+ *
+ * @param modelType A model type
+ * @return The processor associated with the given model type
+ */
+ P getProcessor(Class<?> modelType);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessor.java
new file mode 100644
index 0000000000..5475fe3b06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessor.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.contribution.processor;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * A processor invoked after the contribution is loaded
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionPostProcessor {
+
+ /**
+ * Visitor pattern to post process the contribution
+ *
+ * @param contribution The contribution to be post processed
+ */
+ void visit(Contribution contribution);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessorExtensionPoint.java
new file mode 100644
index 0000000000..4aa866b6f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ContributionPostProcessorExtensionPoint.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.sca.contribution.processor;
+
+/**
+ * An extension point for contribution post processor extensions.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionPostProcessorExtensionPoint {
+
+ /**
+ * Add a ContributionPostProcessor
+ *
+ * @param processor The post processor
+ */
+ void addPostProcessor(ContributionPostProcessor processor);
+
+ /**
+ * Remove a ContributionPostProcessor
+ *
+ * @param processor The post processor
+ */
+ void removePostProcessor(ContributionPostProcessor processor);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..1c2faf9503
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.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.sca.contribution.processor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The default implementation of an artifact processor registry.
+ *
+ * @version $Rev$ $Date$
+ */
+abstract class DefaultArtifactProcessorExtensionPoint<P> {
+ protected final Map<Object, P> processorsByArtifactType = new HashMap<Object, P>();
+ protected final Map<Class<?>, P> processorsByModelType = new HashMap<Class<?>, P>();
+
+ /**
+ * Constructs a new loader registry.
+ */
+ public DefaultArtifactProcessorExtensionPoint() {
+ }
+
+ /**
+ * Returns the processor associated with the given artifact type.
+ *
+ * @param artifactType An artifact type
+ * @return The processor associated with the given artifact type
+ */
+ public P getProcessor(Object artifactType) {
+ return processorsByArtifactType.get(artifactType);
+ }
+
+ /**
+ * Returns the processor associated with the given model type.
+ *
+ * @param modelType A model type
+ * @return The processor associated with the given model type
+ */
+ public P getProcessor(Class<?> modelType) {
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ P processor = processorsByModelType.get(c);
+ if (processor != null) {
+ return processor;
+ }
+ }
+ return processorsByModelType.get(modelType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..15fb1d838f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.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.contribution.processor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Default implementation of ContributionProcessorRegistry
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPackageProcessorExtensionPoint implements PackageProcessorExtensionPoint {
+
+ /**
+ * Processor registry
+ */
+ private Map<String, PackageProcessor> registry = new HashMap<String, PackageProcessor>();
+
+ public DefaultPackageProcessorExtensionPoint() {
+ }
+
+ public void addPackageProcessor(PackageProcessor processor) {
+ registry.put(processor.getPackageType(), processor);
+ }
+
+ public void removePackageProcessor(PackageProcessor processor) {
+ registry.remove(processor.getPackageType());
+ }
+
+ public PackageProcessor getPackageProcessor(String contentType) {
+ return registry.get(contentType);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..8b9333666c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * The default implementation of an extension point for StAX artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultStAXArtifactProcessorExtensionPoint
+ extends DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor>
+ implements StAXArtifactProcessorExtensionPoint {
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultStAXArtifactProcessorExtensionPoint() {
+ }
+
+ public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..47c81fd04d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * The default implementation of a StAX artifact processor registry.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultURLArtifactProcessorExtensionPoint
+ extends DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor>
+ implements URLArtifactProcessorExtensionPoint {
+
+ /**
+ * Constructs a new extension point.
+ */
+ public DefaultURLArtifactProcessorExtensionPoint() {
+ }
+
+ public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
+ processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
+ }
+
+ public void removeArtifactProcessor(URLArtifactProcessor artifactProcessor) {
+ processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
+ processorsByModelType.remove(artifactProcessor.getModelType());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java
new file mode 100644
index 0000000000..ac8fd6f272
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.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.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.TypeDescriber;
+import org.apache.tuscany.sca.contribution.service.UnsupportedContentTypeException;
+
+/**
+ * Default implementation of PackageProcessor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensiblePackageProcessor implements PackageProcessor {
+
+ private PackageProcessorExtensionPoint processors;
+
+ /**
+ * Helper method to describe contentType for each artifact
+ */
+ private TypeDescriber packageTypeDescriber;
+
+ public ExtensiblePackageProcessor(PackageProcessorExtensionPoint processors, TypeDescriber packageTypeDescriber) {
+ this.processors = processors;
+ this.packageTypeDescriber = packageTypeDescriber;
+ }
+
+ public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream)
+ throws ContributionException, IOException {
+ String contentType = this.packageTypeDescriber.getType(packageSourceURL, null);
+ if (contentType == null) {
+ throw new UnsupportedContentTypeException("Unsupported contribution package", packageSourceURL.toString());
+ }
+
+ PackageProcessor packageProcessor = this.processors.getPackageProcessor(contentType);
+ if (packageProcessor == null) {
+ throw new UnsupportedContentTypeException(contentType, packageSourceURL.getPath());
+ }
+
+ return packageProcessor.getArtifacts(packageSourceURL, inputStream);
+ }
+
+ public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
+ String contentType = this.packageTypeDescriber.getType(packageSourceURL, null);
+ PackageProcessor packageProcessor = this.processors.getPackageProcessor(contentType);
+ return packageProcessor.getArtifactURL(packageSourceURL, artifact);
+ }
+
+ public String getPackageType() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
new file mode 100644
index 0000000000..40575960f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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.contribution.service.UnrecognizedElementException;
+
+/**
+ * The default implementation of a StAX artifact processor registry.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleStAXArtifactProcessor
+ implements StAXArtifactProcessor<Object> {
+
+ private XMLInputFactory inputFactory;
+ private XMLOutputFactory outputFactory;
+ private StAXArtifactProcessorExtensionPoint processors;
+
+ /**
+ * Constructs a new loader registry.
+ * @param inputFactory
+ * @param outputFactory
+ */
+ public ExtensibleStAXArtifactProcessor(StAXArtifactProcessorExtensionPoint processors, XMLInputFactory inputFactory, XMLOutputFactory outputFactory) {
+ super();
+ this.processors = processors;
+ this.inputFactory = inputFactory;
+ this.outputFactory = outputFactory;
+ this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
+ }
+
+ public Object read(XMLStreamReader source) throws ContributionReadException {
+
+ // Delegate to the processor associated with the element qname
+ QName name = source.getName();
+ StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)processors.getProcessor(name);
+ if (processor == null) {
+ return null;
+ }
+ try {
+ return processor.read(source);
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ try {
+ processor.write(model, outputSource);
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ /**
+ * Read a model from an input stream.
+ * @param is The artifact inputstream
+ * @param type Model type
+ * @return The model
+ * @throws ContributionReadException
+ */
+ public <MO> MO read(InputStream is, Class<MO> type) throws ContributionReadException {
+ try {
+ XMLStreamReader reader;
+ try {
+ reader = inputFactory.createXMLStreamReader(is);
+ try {
+ reader.nextTag();
+ QName name = reader.getName();
+ Object mo = read(reader);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(name);
+ throw e;
+ }
+ } catch (ContributionReadException e) {
+ Location location = reader.getLocation();
+ e.setLine(location.getLineNumber());
+ e.setColumn(location.getColumnNumber());
+ throw e;
+ } finally {
+ try {
+ reader.close();
+ } catch (XMLStreamException e) {
+ // ignore
+ }
+ }
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ } catch (XMLStreamException e) {
+ ContributionReadException ce = new ContributionReadException(e);
+ throw ce;
+ }
+ }
+
+ /**
+ * Write a model to an ouput stream.
+ * @param model
+ * @param os
+ * @throws ContributionWriteException
+ */
+ public void write(Object model, OutputStream os) throws ContributionWriteException {
+ try {
+ XMLStreamWriter writer = outputFactory.createXMLStreamWriter(os);
+ write(model, writer);
+ writer.flush();
+ writer.close();
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public QName getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java
new file mode 100644
index 0000000000..40917861da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.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.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+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.UnrecognizedElementException;
+
+/**
+ * The default implementation of a URL artifact processor.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleURLArtifactProcessor
+ implements URLArtifactProcessor<Object> {
+
+ private URLArtifactProcessorExtensionPoint processors;
+
+ /**
+ * Constructs a new URL artifact processor.
+ *
+ * @param processors
+ */
+ public ExtensibleURLArtifactProcessor(URLArtifactProcessorExtensionPoint processors) {
+ this.processors = processors;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object read(URL contributionURL, URI sourceURI, URL sourceURL) throws ContributionReadException {
+ URLArtifactProcessor<Object> processor = null;
+
+ // Delegate to the processor associated with file extension
+ String extension = sourceURL.getFile();
+ int extensionStart = extension.lastIndexOf('.');
+ //handle files without extension (e.g NOTICE)
+ if (extensionStart > 0) {
+ extension = extension.substring(extensionStart);
+ processor = (URLArtifactProcessor<Object>)processors.getProcessor(extension);
+ }
+ if (processor == null) {
+ return null;
+ }
+ return processor.read(contributionURL, sourceURI, sourceURL);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
+
+ // Delegate to the processor associated with the model type
+ if (model != null) {
+ URLArtifactProcessor processor = processors.getProcessor(model.getClass());
+ if (processor != null) {
+ processor.resolve(model, resolver);
+ }
+ }
+ }
+
+ public <MO> MO read(URL contributionURL, URI artifactURI, URL artifactUrl, Class<MO> type)
+ throws ContributionReadException {
+ Object mo = read(contributionURL, artifactURI, artifactUrl);
+ if (type.isInstance(mo)) {
+ return type.cast(mo);
+ } else {
+ UnrecognizedElementException e = new UnrecognizedElementException(null);
+ e.setResourceURI(artifactURI.toString());
+ throw e;
+ }
+ }
+
+ public String getArtifactType() {
+ return null;
+ }
+
+ public Class<Object> getModelType() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java
new file mode 100644
index 0000000000..28b268301f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.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.sca.contribution.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Contribution package processors
+ * These processors understand the internal format of the contribution and how to process the artifacts
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageProcessor {
+
+ /**
+ * Returns the type of package supported by this package processor.
+ *
+ * @return the package type
+ */
+ String getPackageType();
+
+ /**
+ * Retrieve a list of artifacts for the specific package type
+ *
+ * @param packageSourceURL Contribution package location URL
+ * @param inputStream Optional content of the package
+ * @return List of artifact URIs
+ * @throws ContributionException
+ * @throws IOException
+ */
+ List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException;
+
+ /**
+ * Return the URL for an artifact in the package.
+ * This is needed in the case of special archives such as jar files that have special
+ * URL structure for internal artifacts
+ *
+ * @param packageSourceURL Contribution package location URL
+ * @param artifact The relative URI for the artifact
+ * @return The artifact URL
+ */
+ URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java
new file mode 100644
index 0000000000..27499b5847
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * An extension point for package processors
+ *
+ * @version $Rev$ $Date$
+ */
+public interface PackageProcessorExtensionPoint {
+
+ /**
+ * Register a PackageProcessor using the package type as the key
+ *
+ * @param processor The package processor
+ */
+ void addPackageProcessor(PackageProcessor processor);
+
+ /**
+ * Unregister a PackageProcessor
+ *
+ * @param processor The package processor
+ */
+ void removePackageProcessor(PackageProcessor processor);
+
+ /**
+ * Returns the PackageProcessor for the given package type.
+ *
+ * @param packageType The package type
+ * @return The package processor
+ */
+ PackageProcessor getPackageProcessor(String packageType);
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java
new file mode 100644
index 0000000000..89c063a65e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.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.contribution.processor;
+
+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.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+/**
+ * An artifact processor that can read models from a StAX XMLStreamReader.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from an input source. Examples of input sources are: a URI, a
+ * DOM node, an XML reader.
+ *
+ * @param inputSource The input source
+ * @return A model representation of the input.
+ */
+ M read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException;
+
+ /**
+ * Writes a model to an ouput source. Examples of output sources are: a URI, a
+ * DOM node, an XML writer.
+ *
+ * @param model A model representing the source
+ * @param outputSource The output source
+ * @throws ContributionWriteException
+ * @throws XMLStreamException
+ */
+ void write(M model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ *
+ * @return The type of artifact handled by this artifact processor
+ */
+ QName getArtifactType();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..9a6388119e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * A registry for DOM artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StAXArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<StAXArtifactProcessor> {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
new file mode 100644
index 0000000000..ca95036912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.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.contribution.processor;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * An artifact processor that can read models from an InputStream.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
+
+ /**
+ * Reads a model from an input source. Examples of input
+ * sources are: a URI, a DOM node, an XML reader.
+ *
+ * @param contributionURL Contribution location URL
+ * @param artifactURI Artifact URI
+ * @param artifactURL Artifact location URL
+ * @return A model representation of the input.
+ */
+ M read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException;
+
+ /**
+ * Returns the type of artifact handled by this artifact processor.
+ *
+ * @return The type of artifact handled by this artifact processor
+ */
+ String getArtifactType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java
new file mode 100644
index 0000000000..95213f9dd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.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.contribution.processor;
+
+/**
+ * A registry for Stream artifact processors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface URLArtifactProcessorExtensionPoint extends
+ ArtifactProcessorExtensionPoint<URLArtifactProcessor> {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
new file mode 100644
index 0000000000..da216983ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.contribution.resolver;
+
+import java.lang.ref.WeakReference;
+
+/**
+ * A weak reference to a class, which should be used to register classes
+ * with an ArtifactResolver and resolve these classes later.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ClassReference {
+
+ private WeakReference<Class> clazz;
+ private String className;
+
+ /**
+ * Constructs a new ClassReference.
+ *
+ * @param clazz The class reference
+ */
+ public ClassReference(Class clazz) {
+ this.clazz = new WeakReference<Class>(clazz);
+ this.className = clazz.getName();
+ }
+
+ /**
+ * Constructs a new ClassReference.
+ *
+ * @param className The class name
+ */
+ public ClassReference(String className) {
+ this.className = className;
+ }
+
+ /**
+ * Get the referenced class.
+ *
+ * @return The referenced class
+ */
+ public Class getJavaClass() {
+ if (clazz != null) {
+ return clazz.get();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get the referenced class name.
+ *
+ * @return The class name
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * Returns true if the class reference is unresolved.
+ *
+ * @return Wether or not the class has been resolved
+ */
+ boolean isUnresolved() {
+ return clazz == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return className.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else {
+ if (obj instanceof ClassReference) {
+ return className.equals(((ClassReference)obj).className);
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
new file mode 100644
index 0000000000..850f79fdea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.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.sca.contribution.resolver;
+
+/**
+ * SCA Assemblies reference many artifacts of a wide variety of types. These
+ * include:
+ * <ul>
+ * <li> Reference from one SCA composite to another SCA composite
+ * <li> Reference to PolicySet files
+ * <li> Reference to interface definition files, either WSDL or Java interfaces
+ * <li> Reference to XSD files
+ * <li> Reference to any of a wide variety of implementation artifact files,
+ * including Java classes, BPEL scripts, C++ DLLs and classes, PHP scripts
+ * </ul>
+ * In the SCA assemblies, these various artifacts are referenced using either
+ * QNames or URIs that do not point to a specific entity. Resolution of these
+ * references to concrete artifacts is necessary as part of the operation of the
+ * SCA domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelResolver {
+
+ /**
+ * Resolve the model representing an artifact.
+ *
+ * @param modelClass the type of artifact
+ * @param unresolved the unresolved model
+ * @return the resolved model
+ */
+ <T> T resolveModel(Class<T> modelClass, T unresolved);
+
+ /**
+ * Add a resolved model.
+ *
+ * @param resolved The model
+ */
+ void addModel(Object resolved);
+
+ /**
+ * Remove a resolved model.
+ *
+ * @param resolved
+ * @return The removed model, or null if the model was not removed
+ */
+ Object removeModel(Object resolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/AbstractContributionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/AbstractContributionException.java
new file mode 100644
index 0000000000..7b58a9c2c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/AbstractContributionException.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.sca.contribution.service;
+
+import java.io.PrintWriter;
+
+/**
+ * The root checked exception for the Contribution Service.
+ *
+ * @version $Rev: 508877 $ $Date: 2007-02-17 22:22:48 -0800 (Sat, 17 Feb 2007) $
+ */
+public abstract class AbstractContributionException extends Exception {
+ private static final long serialVersionUID = -7847121698339635268L;
+ private final String identifier;
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @see Exception
+ */
+ public AbstractContributionException() {
+ super();
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message) {
+ super(message);
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param identifier additional error information referred to in the error message
+ * @see Exception
+ */
+ public AbstractContributionException(String message, String identifier) {
+ super(message);
+ this.identifier = identifier;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message, Throwable cause) {
+ super(message, cause);
+ this.identifier = null;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param message passed to Exception
+ * @param identifier additional error information referred to in the error message
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(String message, String identifier, Throwable cause) {
+ super(message, cause);
+ this.identifier = identifier;
+ }
+
+ /**
+ * Override constructor from Exception.
+ *
+ * @param cause passed to Exception
+ * @see Exception
+ */
+ public AbstractContributionException(Throwable cause) {
+ super(cause);
+ this.identifier = null;
+ }
+
+ /**
+ * Returns a string representing additional error information referred to in the error message.
+ *
+ * @return additional error information
+ */
+ public String getIdentifier() {
+ return identifier;
+ }
+
+ public PrintWriter appendBaseMessage(PrintWriter writer) {
+ if (identifier == null) {
+ if (super.getMessage() == null) {
+ return writer;
+ }
+ return writer.append(super.getMessage());
+ }
+ if (super.getMessage() != null) {
+ writer.append(super.getMessage());
+ }
+ writer.append(" [").append(identifier).append(']');
+ return writer;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java
new file mode 100644
index 0000000000..84dcdc19c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.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.contribution.service;
+
+/**
+ * Base class for exceptions raised by contribution services.
+ *
+ * @version $Rev: 519710 $ $Date: 2007-03-18 15:19:16 -0700 (Sun, 18 Mar 2007) $
+ */
+public class ContributionException extends AbstractContributionException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 4432880414927652578L;
+
+ protected ContributionException() {
+ super();
+ }
+
+ protected ContributionException(String message) {
+ super(message);
+ }
+
+ protected ContributionException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected ContributionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected ContributionException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ContributionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoader.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoader.java
new file mode 100644
index 0000000000..e41b13a567
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoader.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.sca.contribution.service;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.Contribution;
+
+/**
+ * Loader responsible to process the contribution metadata loader
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionMetadataLoader {
+ /**
+ * Create the model object for Contribution Service metadata information
+ *
+ * @param contribution The contribution to populate with the proper values from the side file
+ * @param reader The XML stream reader positioned on the applicable START_ELEMENT
+ * @throws XMLStreamException
+ * @throws ContributionMetadataReadException
+ */
+ void load(Contribution contribution, XMLStreamReader reader) throws XMLStreamException, ContributionMetadataLoaderException;
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoaderException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoaderException.java
new file mode 100644
index 0000000000..7dd52c6c1a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionMetadataLoaderException.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.contribution.service;
+
+/**
+ * Denotes an exception while processing the contribution metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataLoaderException extends ContributionException {
+ private static final long serialVersionUID = 2442537028550702609L;
+
+ public ContributionMetadataLoaderException() {
+ super();
+ }
+
+ public ContributionMetadataLoaderException(String message) {
+ super(message);
+ }
+
+ public ContributionMetadataLoaderException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ public ContributionMetadataLoaderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionMetadataLoaderException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ public ContributionMetadataLoaderException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
new file mode 100644
index 0000000000..f84fd98f0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.contribution.service;
+
+/**
+ * Denotes an exception while reading artifacts inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionReadException extends ContributionException {
+ public static final int UNDEFINED = -1;
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+ private int line = UNDEFINED;
+ private int column = UNDEFINED;
+
+ public ContributionReadException(String message) {
+ super(message);
+ }
+
+ public ContributionReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionReadException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being read.
+ *
+ * @return the location of the resource that was being read
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being read.
+ *
+ * @param resourceURI the location of the resource that was being read
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+ /**
+ * Returns the line inside the resource that was being read.
+ * @return the line inside the resource that was being read
+ */
+ public int getLine() {
+ return line;
+ }
+
+ /**
+ * Sets the line inside the resource that was being read.
+ * @param line the line inside the resource that was being read
+ */
+ public void setLine(int line) {
+ this.line = line;
+ }
+
+ /**
+ * Returns the column inside the resource that was being read.
+ * @return the column inside the resource that was being read
+ */
+ public int getColumn() {
+ return column;
+ }
+
+ /**
+ * Sets the column inside the resource that was being read.
+ * @param column the column inside the resource that was being read
+ */
+ public void setColumn(int column) {
+ this.column = column;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java
new file mode 100644
index 0000000000..d4c69bede3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.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.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+/**
+ * Contribution repository
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContributionRepository {
+ /**
+ * Get the URI of the SCA domain
+ *
+ * @return The domain URI
+ */
+ URI getDomain();
+
+ /**
+ * Copies a contribution to the repository.
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param sourceURL url of the source. this would be used to calculate the right
+ * filename to be stored on the repository when a inputStream is being
+ * provided
+ * @param contributionStream InputStream with the content of the
+ * distribution
+ * @return A URL pointing to the content of the contribution in the
+ * repository
+ * @throws IOException
+ */
+ URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException;
+ /**
+ * Copy a contribution from the source URL to the repository
+ *
+ * @param contribution A URl pointing to the contribution being copied to
+ * the repository
+ * @param sourceURL url of the source. this would be used to calculate the right
+ * filename to be stored on the repository when a inputStream is being
+ * provided
+ * @return A URL pointing to the content of the contribution in the
+ * repository
+ * @throws IOException
+ */
+ URL store(String contribution, URL sourceURL) throws IOException;
+
+ /**
+ * Look up the contribution by URI
+ *
+ * @param contribution The URI of the contribution
+ * @return A URL pointing to the content of the contribution in the
+ * repository, it will be null if the contribution cannot be found
+ * in the repository
+ */
+ URL find(String contribution);
+
+ /**
+ * Remove a contribution from the repository
+ *
+ * @param contribution The URI of the contribution to be removed
+ */
+ void remove(String contribution);
+
+ /**
+ * Get list of URIs for all the contributions in the repository
+ *
+ * @return A list of contribution URIs
+ */
+ List<String> list();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java
new file mode 100644
index 0000000000..e9392f55eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.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.sca.contribution.service;
+
+/**
+ * Denotes a problem while resolving models inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionResolveException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+
+ public ContributionResolveException(String message) {
+ super(message);
+ }
+
+ public ContributionResolveException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionResolveException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java
new file mode 100644
index 0000000000..90dae0018c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.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.sca.contribution.service;
+
+/**
+ * Base class for runtime exceptions raised by contribution services.
+ *
+ * @version $Rev: 526837 $ $Date: 2007-04-09 10:10:18 -0700 (Mon, 09 Apr 2007) $
+ */
+public class ContributionRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = 7711215366287498896L;
+
+ protected ContributionRuntimeException() {
+ super();
+ }
+
+ protected ContributionRuntimeException(String message) {
+ super(message);
+ }
+
+ protected ContributionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
new file mode 100644
index 0000000000..1b21e60fbe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.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.sca.contribution.service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+/**
+ * Service interface that manages artifacts contributed to a Tuscany runtime.
+ *
+ * @version $Rev: 527398 $ $Date: 2007-04-10 23:43:31 -0700 (Tue, 10 Apr 2007) $
+ */
+public interface ContributionService {
+ /**
+ * Contribute an artifact to the SCA Domain. The type of the contribution is
+ * determined by the Content-Type of the resource or, if that is undefined,
+ * by some implementation-specific means (such as mapping an extension in
+ * the URL's path).
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL The location of the resource containing the artifact
+ * @param modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param storeInRepository Flag that identifies if you want to copy the
+ * contribution to the repository
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the resource
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, ModelResolver modelResolver, boolean storeInRepository) throws ContributionException,
+ IOException;
+
+ /**
+ * Contribute an artifact to the SCA Domain.
+ *
+ * @param contributionURI The URI that is used as the contribution unique ID.
+ * @param sourceURL The location of the resource containing the artifact.
+ * This is used to identify what name should be used when storing
+ * the contribution on the repository
+ * @param modelResolver The model resolver to use to resolve models in the
+ * scope of this contribution
+ * @param contributionContent A stream containing the resource being
+ * contributed; the stream will not be closed but the read
+ * position after the call is undefined
+ * @return The contribution model representing the contribution
+ * @throws DeploymentException if there was a problem with the contribution
+ * @throws IOException if there was a problem reading the stream
+ */
+ Contribution contribute(String contributionURI, URL sourceURL, InputStream contributionContent, ModelResolver modelResolver)
+ throws ContributionException, IOException;
+
+ /**
+ * Get the model for an installed contribution
+ *
+ * @param contribution The URI of an installed contribution
+ * @return The model for the contribution or null if there is no such
+ * contribution
+ */
+ Contribution getContribution(String contribution);
+
+ /**
+ * Adds or updates a deployment composite using a supplied composite
+ * ("composite by value" - a data structure, not an existing resource in the
+ * domain) to the contribution identified by a supplied contribution URI.
+ * The added or updated deployment composite is given a relative URI that
+ * matches the "name" attribute of the composite, with a ".composite"
+ * suffix.
+ *
+ * @param contribution The contribution to where
+ * @param composite
+ * @throws ContributionException
+ */
+ void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException;
+
+ /**
+ * Remove a contribution from the SCA domain
+ *
+ * @param contribution The URI of the contribution
+ * @throws DeploymentException
+ */
+ void remove(String contribution) throws ContributionException;
+
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWireException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWireException.java
new file mode 100644
index 0000000000..6d13a0dfb7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWireException.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.sca.contribution.service;
+
+
+/**
+ * Denotes a problem while wiring models inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionWireException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+
+ public ContributionWireException(String message) {
+ super(message);
+ }
+
+ public ContributionWireException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionWireException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java
new file mode 100644
index 0000000000..db078ebdf3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.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.contribution.service;
+
+
+/**
+ * Denotes an exception while writing artifacts inside an SCA contribution.
+ *
+ * @version $Rev: 526268 $ $Date: 2007-04-06 13:13:26 -0700 (Fri, 06 Apr 2007) $
+ */
+public class ContributionWriteException extends ContributionException {
+ private static final long serialVersionUID = -7459051598906813461L;
+ private String resourceURI;
+
+ public ContributionWriteException(String message) {
+ super(message);
+ }
+
+ public ContributionWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ContributionWriteException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Returns the location of the resource that was being written.
+ *
+ * @return the location of the resource that was being written
+ */
+ public String getResourceURI() {
+ return resourceURI;
+ }
+
+ /**
+ * Sets the location of the resource that was being written.
+ *
+ * @param resourceURI the location of the resource that was being written
+ */
+ public void setResourceURI(String resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/InvalidConfigurationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/InvalidConfigurationException.java
new file mode 100644
index 0000000000..a3ff0072a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/InvalidConfigurationException.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.contribution.service;
+
+/**
+ * Denotes an invalid configuration artifact
+ *
+ * @version $Rev: 525638 $ $Date: 2007-04-04 16:36:03 -0700 (Wed, 04 Apr 2007) $
+ */
+public class InvalidConfigurationException extends ContributionReadException {
+ private static final long serialVersionUID = -4312958640212000366L;
+
+ public InvalidConfigurationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java
new file mode 100644
index 0000000000..46ad89fc78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.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.contribution.service;
+
+import java.net.URL;
+
+/**
+ * Provide content type for a given resource
+ *
+ * @version $Rev: 526079 $ $Date: 2007-04-06 00:17:44 -0700 (Fri, 06 Apr 2007) $
+ */
+public interface TypeDescriber {
+ /**
+ * Get the content type for the specified resource
+ *
+ * @param resourceURL The resource url
+ * @param defaultType The default content type
+ * @return The content type
+ */
+ String getType(URL resourceURL, String defaultType);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java
new file mode 100644
index 0000000000..42d74e5e22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.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.contribution.service;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Exception that indicates an element was encountered that could not be handled.
+ *
+ * @version $Rev: 525638 $ $Date: 2007-04-04 16:36:03 -0700 (Wed, 04 Apr 2007) $
+ */
+public class UnrecognizedElementException extends ContributionReadException {
+ private static final long serialVersionUID = 2549543622209829032L;
+ private final QName element;
+
+ /**
+ * Constructor that indicates which element could not be handled.
+ * @param element the element that could not be handled
+ */
+ public UnrecognizedElementException(QName element) {
+ super("Unrecognized element: " + element.toString());
+ this.element = element;
+ }
+
+ /**
+ * Returns the element that could not be handled.
+ * @return the element that could not be handled.
+ */
+ public QName getElement() {
+ return element;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java
new file mode 100644
index 0000000000..737362eb97
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.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.contribution.service;
+
+/**
+ * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
+ * The Content-Type value supplied will be returned as the message text for this exception.
+ *
+ * @version $Rev: 522653 $ $Date: 2007-03-26 15:30:21 -0700 (Mon, 26 Mar 2007) $
+ */
+public class UnsupportedContentTypeException extends ContributionException {
+ private static final long serialVersionUID = -1831797280021355672L;
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported.
+ *
+ * @param contentType the type that is not supported
+ */
+ public UnsupportedContentTypeException(String contentType) {
+ super(contentType);
+ }
+
+ /**
+ * Constructor specifying the Content-Type value that is not supported
+ * and an identifier to use with this exception (typically the resource being processed).
+ *
+ * @param contentType the type that is not supported
+ * @param identifier an identifier for this exception
+ */
+ public UnsupportedContentTypeException(String contentType, String identifier) {
+ super(contentType, identifier);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.checkstyle
new file mode 100644
index 0000000000..c7b30ffd5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.checkstyle
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<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/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/.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/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/pom.xml
new file mode 100644
index 0000000000..be77b02907
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/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>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Core/DataBinding Integration</name>
+ <description>Apache Tuscany Core/DataBinding Integration</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <scope>runtime</scope>
+ <version>3.2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <!--
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ -->
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/module/DataBindingModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/module/DataBindingModuleActivator.java
new file mode 100644
index 0000000000..32666174b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/module/DataBindingModuleActivator.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.core.databinding.module;
+
+import org.apache.tuscany.core.databinding.processor.DataBindingJavaInterfaceProcessor;
+import org.apache.tuscany.core.databinding.transformers.Exception2ExceptionTransformer;
+import org.apache.tuscany.core.databinding.transformers.Input2InputTransformer;
+import org.apache.tuscany.core.databinding.transformers.Output2OutputTransformer;
+import org.apache.tuscany.core.databinding.wire.DataBindingRuntimeWireProcessor;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.DOMNode2JavaBeanTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.databinding.xml.InputSource2Node;
+import org.apache.tuscany.sca.databinding.xml.InputSource2SAX;
+import org.apache.tuscany.sca.databinding.xml.InputStream2Node;
+import org.apache.tuscany.sca.databinding.xml.InputStream2SAX;
+import org.apache.tuscany.sca.databinding.xml.Node2OutputStream;
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.apache.tuscany.sca.databinding.xml.Node2Writer;
+import org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.xml.Reader2Node;
+import org.apache.tuscany.sca.databinding.xml.Reader2SAX;
+import org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;
+import org.apache.tuscany.sca.databinding.xml.Source2ResultTransformer;
+import org.apache.tuscany.sca.databinding.xml.StreamDataPipe;
+import org.apache.tuscany.sca.databinding.xml.String2Node;
+import org.apache.tuscany.sca.databinding.xml.String2SAX;
+import org.apache.tuscany.sca.databinding.xml.String2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.xml.Writer2ReaderDataPipe;
+import org.apache.tuscany.sca.databinding.xml.XMLGroupDataBinding;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2SAX;
+import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
+import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataBindingModuleActivator implements ModuleActivator {
+
+ private DataBindingExtensionPoint dataBindings;
+ private TransformerExtensionPoint transformers;
+
+ public Object[] getExtensionPoints() {
+ dataBindings = new DefaultDataBindingExtensionPoint();
+ transformers = new DefaultTransformerExtensionPoint(dataBindings);
+ return new Object[] { dataBindings, transformers };
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
+ input2InputTransformer.setMediator(mediator);
+
+ Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer();
+ output2OutputTransformer.setMediator(mediator);
+
+ Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer();
+ exception2ExceptionTransformer.setMediator(mediator);
+
+ transformers.addTransformer(input2InputTransformer);
+ transformers.addTransformer(output2OutputTransformer);
+ transformers.addTransformer(exception2ExceptionTransformer);
+
+ JavaInterfaceIntrospectorExtensionPoint introspectors = registry
+ .getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ introspectors.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings));
+
+ RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry
+ .getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
+ if (wireProcessorExtensionPoint != null) {
+ wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator));
+ }
+
+ DOMDataBinding domDataBinding = new DOMDataBinding();
+ domDataBinding.setDataBindingRegistry(dataBindings);
+ dataBindings.addDataBinding(domDataBinding);
+ XMLStringDataBinding xmlStringDataBinding = new XMLStringDataBinding();
+ xmlStringDataBinding.setDataBindingRegistry(dataBindings);
+ dataBindings.addDataBinding(xmlStringDataBinding);
+ XMLGroupDataBinding xmlGroupDataBinding = new XMLGroupDataBinding();
+ xmlGroupDataBinding.setDataBindingRegistry(dataBindings);
+ dataBindings.addDataBinding(xmlGroupDataBinding);
+ JavaBeansDataBinding javaBeansDataBinding = new JavaBeansDataBinding();
+ javaBeansDataBinding.setDataBindingRegistry(dataBindings);
+ dataBindings.addDataBinding(javaBeansDataBinding);
+
+ Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
+ group2GroupTransformer.setMediator(mediator);
+ transformers.addTransformer(group2GroupTransformer);
+
+ transformers.addTransformer(new InputSource2Node());
+ transformers.addTransformer(new InputSource2SAX());
+ transformers.addTransformer(new InputStream2Node());
+ transformers.addTransformer(new InputStream2SAX());
+
+ transformers.addTransformer(new DOMNode2JavaBeanTransformer());
+ transformers.addTransformer(new Node2OutputStream());
+ transformers.addTransformer(new Node2String());
+ transformers.addTransformer(new Node2Writer());
+ transformers.addTransformer(new Node2XMLStreamReader());
+
+ transformers.addTransformer(new JavaBean2DOMNodeTransformer());
+ transformers.addTransformer(new Reader2Node());
+
+ transformers.addTransformer(new Reader2SAX());
+ transformers.addTransformer(new SAX2DOMPipe());
+
+ transformers.addTransformer(new Source2ResultTransformer());
+ transformers.addTransformer(new StreamDataPipe());
+ transformers.addTransformer(new String2Node());
+ transformers.addTransformer(new String2SAX());
+ transformers.addTransformer(new String2XMLStreamReader());
+ transformers.addTransformer(new Writer2ReaderDataPipe());
+
+ transformers.addTransformer(new XMLStreamReader2Node());
+ transformers.addTransformer(new XMLStreamReader2SAX());
+ transformers.addTransformer(new XMLStreamReader2String());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..b26846c682
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessor.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.core.databinding.processor;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * The databinding annotation processor for java interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingJavaInterfaceProcessor implements JavaInterfaceVisitor {
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ public DataBindingJavaInterfaceProcessor(@Reference
+ DataBindingExtensionPoint dataBindingRegistry) {
+ super();
+ this.dataBindingRegistry = dataBindingRegistry;
+ }
+
+ public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
+ if (!javaInterface.isRemotable()) {
+ return;
+ }
+ List<Operation> operations = javaInterface.getOperations();
+ processInterface(javaInterface, operations);
+ }
+
+ private void introspectWrapperStyle(Operation operation) {
+ if (operation.isWrapperStyle()) {
+ return;
+ }
+ DataType outputType = operation.getOutputType();
+ DataType<List<DataType>> inputType = operation.getInputType();
+ if (outputType == null || inputType == null) {
+ return;
+ }
+ if (inputType.getLogical().size() != 1) {
+ return;
+ }
+ DataType wrapperType = inputType.getLogical().get(0);
+ if (outputType.getDataBinding().equals(wrapperType.getDataBinding())) {
+ operation.setWrapperStyle(true);
+ operation.setDataBinding(outputType.getDataBinding());
+ }
+ }
+
+ private void processInterface(JavaInterface javaInterface, List<Operation> operations) {
+ Class<?> clazz = javaInterface.getJavaClass();
+ DataBinding dataBinding = clazz.getAnnotation(DataBinding.class);
+ String dataBindingId = null;
+ boolean wrapperStyle = false;
+ if (dataBinding != null) {
+ dataBindingId = dataBinding.value();
+ wrapperStyle = dataBinding.wrapperStyle();
+ }
+
+ Map<String, Operation> opMap = new HashMap<String, Operation>();
+ for (Operation op : javaInterface.getOperations()) {
+ opMap.put(op.getName(), op);
+ if (dataBindingId != null) {
+ op.setDataBinding(dataBindingId);
+ op.setWrapperStyle(wrapperStyle);
+ }
+ }
+ for (Method method : clazz.getMethods()) {
+ Operation operation = opMap.get(method.getName());
+ DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
+ if (methodDataBinding == null) {
+ methodDataBinding = dataBinding;
+ }
+ dataBindingId = null;
+ wrapperStyle = false;
+ if (dataBinding != null) {
+ dataBindingId = dataBinding.value();
+ wrapperStyle = dataBinding.wrapperStyle();
+ operation.setDataBinding(dataBindingId);
+ operation.setWrapperStyle(wrapperStyle);
+ }
+
+ // FIXME: We need a better way to identify simple java types
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ dataBindingRegistry.introspectType(d, method.getAnnotations());
+ }
+ if (operation.getOutputType() != null) {
+ DataType<?> d = operation.getOutputType();
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ dataBindingRegistry.introspectType(d, method.getAnnotations());
+ }
+ for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getFaultTypes()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBindingId);
+ }
+ dataBindingRegistry.introspectType(d, method.getAnnotations());
+ }
+
+ // FIXME: Do we want to heuristically check the wrapper style?
+ // introspectWrapperStyle(operation);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Exception2ExceptionTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Exception2ExceptionTransformer.java
new file mode 100644
index 0000000000..9711fe881a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Exception2ExceptionTransformer.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.core.databinding.transformers;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is a special transformer to transform the exception from one IDL to the
+ * other one
+ */
+@Service(Transformer.class)
+public class Exception2ExceptionTransformer extends BaseTransformer<Object[], Object[]> implements
+ PullTransformer<Exception, Exception> {
+
+ protected Mediator mediator;
+
+ public Exception2ExceptionTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return DataBinding.IDL_FAULT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return DataBinding.IDL_FAULT;
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Exception.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Exception.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10000;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Exception transform(Exception source, TransformationContext context) {
+ DataType<DataType> sourceType = context.getSourceDataType();
+
+ DataType<DataType> targetType = context.getTargetDataType();
+
+ ExceptionHandler exceptionHandler = getExceptionHandler(sourceType);
+ if (exceptionHandler == null) {
+ return source;
+ }
+
+ Object sourceFaultInfo = exceptionHandler.getFaultInfo(source);
+ Object targetFaultInfo =
+ mediator.mediate(sourceFaultInfo, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
+
+ ExceptionHandler targetHandler = getExceptionHandler(targetType);
+
+ if (targetHandler != null) {
+ Exception targetException =
+ targetHandler.createException(targetType, source.getMessage(), targetFaultInfo, source.getCause());
+ return targetException;
+ }
+
+ // FIXME
+ return source;
+
+ }
+
+ private ExceptionHandler getExceptionHandler(DataType<DataType> targetType) {
+ DataType targetFaultType = (DataType)targetType.getLogical();
+ DataBinding targetDataBinding =
+ mediator.getDataBindings().getDataBinding(targetFaultType.getDataBinding());
+ if (targetDataBinding == null) {
+ return null;
+ }
+ ExceptionHandler targetHandler = targetDataBinding.getExceptionHandler();
+ return targetHandler;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.java
new file mode 100644
index 0000000000..3b4a189193
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Input2InputTransformer.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.core.databinding.transformers;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+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 Input2InputTransformer extends BaseTransformer<Object[], Object[]> implements
+ PullTransformer<Object[], Object[]> {
+
+ protected Mediator mediator;
+
+ public Input2InputTransformer() {
+ super();
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return DataBinding.IDL_INPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return DataBinding.IDL_INPUT;
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object[].class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10000;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object[] transform(Object[] source, TransformationContext context) {
+ DataType<List<DataType>> sourceType = context.getSourceDataType();
+ Operation sourceOp = context.getSourceOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+
+ WrapperHandler sourceWrapperHandler = null;
+ String sourceDataBinding = getDataBinding(sourceOp);
+ if (sourceWrapped) {
+ sourceWrapperHandler = getWrapperHandler(sourceDataBinding, true);
+ }
+
+ DataType<List<DataType>> targetType = context.getTargetDataType();
+ Operation targetOp = (Operation)context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+ WrapperHandler targetWrapperHandler = null;
+ String targetDataBinding = null;
+ if (targetWrapped) {
+ targetDataBinding = getDataBinding(targetOp);
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, true);
+ }
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ ElementInfo wrapperElement = wrapper.getInputWrapperElement();
+
+ // If the source can be wrapped, wrapped it first
+ if (sourceWrapperHandler != null) {
+ Object sourceWrapper = sourceWrapperHandler.create(wrapperElement, context);
+ for (int i = 0; i < source.length; i++) {
+ ElementInfo argElement = wrapper.getInputChildElements().get(i);
+ sourceWrapperHandler.setChild(sourceWrapper, i, argElement, source[0]);
+ }
+ }
+ Object targetWrapper = targetWrapperHandler.create(wrapperElement, context);
+ if (source == null) {
+ return new Object[] {targetWrapper};
+ }
+ List<DataType> argTypes = wrapper.getUnwrappedInputType().getLogical();
+
+ for (int i = 0; i < source.length; i++) {
+ ElementInfo argElement = wrapper.getInputChildElements().get(i);
+ DataType<XMLType> argType = argTypes.get(i);
+ Object child = source[i];
+ child = mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context.getMetadata());
+ targetWrapperHandler.setChild(targetWrapper, i, argElement, child);
+ }
+ return new Object[] {targetWrapper};
+ } else if (sourceWrapped && (!targetWrapped)) {
+ // Wrapped to Unwrapped
+ Object sourceWrapper = source[0];
+ // List<ElementInfo> childElements =
+ // sourceOp.getWrapper().getInputChildElements();
+ Object[] target = null;
+
+ targetWrapperHandler = getWrapperHandler(targetDataBinding, false);
+ if (targetWrapperHandler != null) {
+ ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
+ // Object targetWrapper =
+ // targetWrapperHandler.create(wrapperElement, context);
+ DataType<XMLType> targetWrapperType = new DataTypeImpl<XMLType>(targetDataBinding, Object.class,
+ new XMLType(wrapperElement));
+ Object targetWrapper = mediator.mediate(sourceWrapper,
+ sourceType.getLogical().get(0),
+ targetWrapperType,
+ context.getMetadata());
+ target = targetWrapperHandler.getChildren(targetWrapper).toArray();
+ } else {
+ Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper).toArray();
+ target = new Object[sourceChildren.length];
+ for (int i = 0; i < sourceChildren.length; i++) {
+ DataType<XMLType> childType = sourceOp.getWrapper().getUnwrappedInputType().getLogical().get(i);
+ target[i] = mediator.mediate(sourceChildren[i], childType, targetType.getLogical().get(i), context
+ .getMetadata());
+ }
+ }
+ return target;
+ } else {
+ // Assuming wrapper to wrapper conversion can be handled here as
+ // well
+ Object[] newArgs = new Object[source.length];
+ for (int i = 0; i < source.length; i++) {
+ Object child = mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical()
+ .get(i), context.getMetadata());
+ newArgs[i] = child;
+ }
+ return newArgs;
+ }
+ }
+
+ private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
+ WrapperHandler wrapperHandler = null;
+ if (dataBindingId != null) {
+ DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
+ wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+ }
+ if (wrapperHandler == null && required) {
+ throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
+ }
+ return wrapperHandler;
+ }
+
+ private String getDataBinding(Operation operation) {
+ return operation.getDataBinding();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java
new file mode 100644
index 0000000000..bf52cedbc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/transformers/Output2OutputTransformer.java
@@ -0,0 +1,185 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.core.databinding.transformers;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.osoa.sca.annotations.Reference;
+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 Output2OutputTransformer extends BaseTransformer<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ public Output2OutputTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ @Reference
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return DataBinding.IDL_OUTPUT;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return DataBinding.IDL_OUTPUT;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10;
+ }
+
+ private String getDataBinding(Operation operation) {
+ return operation.getDataBinding();
+ }
+
+ private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
+ WrapperHandler wrapperHandler = null;
+ if (dataBindingId != null) {
+ DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
+ wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
+ }
+ if (wrapperHandler == null && required) {
+ throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
+ }
+ return wrapperHandler;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object response, TransformationContext context) {
+ try {
+ DataType<DataType> sourceType = context.getSourceDataType();
+ Operation sourceOp = context.getSourceOperation();
+ boolean sourceWrapped = sourceOp != null && sourceOp.isWrapperStyle();
+ WrapperHandler sourceWrapperHandler = null;
+ if (sourceWrapped) {
+ sourceWrapperHandler = getWrapperHandler(getDataBinding(sourceOp), true);
+ }
+
+ DataType<DataType> targetType = context.getTargetDataType();
+ Operation targetOp = context.getTargetOperation();
+ boolean targetWrapped = targetOp != null && targetOp.isWrapperStyle();
+ WrapperHandler targetWrapperHandler = null;
+ if (targetWrapped) {
+ targetWrapperHandler = getWrapperHandler(getDataBinding(targetOp), true);
+ }
+
+ if ((!sourceWrapped) && targetWrapped) {
+ // Unwrapped --> Wrapped
+ WrapperInfo wrapper = targetOp.getWrapper();
+ Object targetWrapper = targetWrapperHandler.create(wrapper.getOutputWrapperElement(), context);
+
+ List<ElementInfo> childElements = wrapper.getOutputChildElements();
+ if (childElements.isEmpty()) {
+ // void output
+ return targetWrapper;
+ }
+ ElementInfo argElement = childElements.get(0);
+ DataType<XMLType> argType = wrapper.getUnwrappedOutputType();
+ Object child = response;
+ child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
+ targetWrapperHandler.setChild(targetWrapper, 0, argElement, child);
+ return targetWrapper;
+ } else if (sourceWrapped && (!targetWrapped)) {
+ // Wrapped to Unwrapped
+ Object sourceWrapper = response;
+ List<ElementInfo> childElements = sourceOp.getWrapper().getOutputChildElements();
+ if (childElements.isEmpty()) {
+ // The void output
+ return null;
+ }
+ targetWrapperHandler = getWrapperHandler(getDataBinding(targetOp), false);
+ if (targetWrapperHandler != null) {
+ ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
+ // Object targetWrapper =
+ // targetWrapperHandler.create(wrapperElement, context);
+ DataType<XMLType> targetWrapperType = new DataTypeImpl<XMLType>(targetType.getLogical()
+ .getDataBinding(), Object.class, new XMLType(wrapperElement));
+ Object targetWrapper = mediator.mediate(sourceWrapper,
+ sourceType.getLogical(),
+ targetWrapperType,
+ context.getMetadata());
+ return targetWrapperHandler.getChildren(targetWrapper).get(0);
+ } else {
+ Object child = sourceWrapperHandler.getChildren(sourceWrapper).get(0);
+ DataType<?> childType = sourceOp.getWrapper().getUnwrappedOutputType();
+ return mediator.mediate(child, childType, targetType.getLogical(), context.getMetadata());
+ }
+ } else {
+ // FIXME: Do we want to handle wrapped to wrapped?
+ return mediator.mediate(response, sourceType.getLogical(), targetType.getLogical(), context
+ .getMetadata());
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingRuntimeWireProcessor.java
new file mode 100644
index 0000000000..feaf48f501
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataBindingRuntimeWireProcessor.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.core.databinding.wire;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+
+/**
+ * This processor is responsible to add an interceptor to invocation chain if
+ * the source and target operations have different databinding requirements
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
+ private Mediator mediator;
+
+ public DataBindingRuntimeWireProcessor(Mediator mediator) {
+ super();
+ this.mediator = mediator;
+ }
+
+ public boolean isTransformationRequired(DataType source, DataType target) {
+ if (source == target) {
+ return false;
+ }
+ String sourceDataBinding = source.getDataBinding();
+ String targetDataBinding = target.getDataBinding();
+ if (sourceDataBinding == targetDataBinding) {
+ return false;
+ }
+ if (sourceDataBinding == null || targetDataBinding == null) {
+ return true;
+ }
+ return !sourceDataBinding.equals(targetDataBinding);
+ }
+
+ public boolean isTransformationRequired(Operation source, Operation target) {
+ if (source == target) {
+ return false;
+ }
+
+ // Check output type
+ DataType sourceOutputType = source.getOutputType();
+ DataType targetOutputType = target.getOutputType();
+
+ // Note the target output type is now the source for checking
+ // compatibility
+ if (isTransformationRequired(targetOutputType, sourceOutputType)) {
+ return true;
+ }
+
+ List<DataType> sourceInputType = source.getInputType().getLogical();
+ List<DataType> targetInputType = target.getInputType().getLogical();
+
+ int size = sourceInputType.size();
+ for (int i = 0; i < size; i++) {
+ if (isTransformationRequired(sourceInputType.get(i), targetInputType.get(i))) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isTransformationRequired(InterfaceContract sourceContract,
+ Operation sourceOperation,
+ InterfaceContract targetContract,
+ Operation targetOperation) {
+ if (targetContract == null) {
+ targetContract = sourceContract;
+ }
+ if (sourceContract == targetContract) {
+ return false;
+ }
+ return isTransformationRequired(sourceOperation, targetOperation);
+ }
+
+ public void process(RuntimeWire wire) {
+ InterfaceContract sourceContract = wire.getSource().getInterfaceContract();
+ InterfaceContract targetContract = wire.getTarget().getInterfaceContract();
+ if (targetContract == null) {
+ targetContract = sourceContract;
+ }
+ if (sourceContract == targetContract) {
+ return;
+ }
+ List<InvocationChain> chains = wire.getInvocationChains();
+ for (InvocationChain chain : chains) {
+ Operation sourceOperation = chain.getSourceOperation();
+ Operation targetOperation = chain.getTargetOperation();
+
+ if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
+ // Add the interceptor to the source side because multiple
+ // references can be wired
+ // to the same service
+ DataTransformationInteceptor interceptor = new DataTransformationInteceptor(wire, sourceOperation,
+ targetOperation);
+ interceptor.setMediator(mediator);
+ chain.addInterceptor(0, interceptor);
+ }
+ }
+
+ // Object targetAddress = UriHelper.getBaseName(source.getUri());
+ List<InvocationChain> callbackChains = wire.getCallbackInvocationChains();
+ if (callbackChains == null) {
+ // callback chains could be null
+ return;
+ }
+
+ for (InvocationChain chain : callbackChains) {
+ Operation sourceOperation = chain.getSourceOperation();
+ Operation targetOperation = chain.getTargetOperation();
+ if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
+
+ // Add the interceptor to the source side because multiple
+ // references can be wired
+ // to the same service
+ DataTransformationInteceptor interceptor = new DataTransformationInteceptor(wire, sourceOperation,
+ targetOperation);
+ interceptor.setMediator(mediator);
+ chain.addInterceptor(0, interceptor);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataTransformationInteceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataTransformationInteceptor.java
new file mode 100644
index 0000000000..39bc6cf913
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/java/org/apache/tuscany/core/databinding/wire/DataTransformationInteceptor.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.core.databinding.wire;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * An interceptor to transform data accross databindings on the wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataTransformationInteceptor implements Interceptor {
+ private Invoker next;
+
+ private Operation sourceOperation;
+
+ private Operation targetOperation;
+
+ private Mediator mediator;
+
+ public DataTransformationInteceptor(RuntimeWire wire,
+ Operation sourceOperation,
+ Operation targetOperation) {
+ super();
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public Message invoke(Message msg) {
+ Object input = transform(msg.getBody(), sourceOperation.getInputType(), targetOperation.getInputType(), false);
+ msg.setBody(input);
+ Message resultMsg = next.invoke(msg);
+ Object result = resultMsg.getBody();
+ if (sourceOperation.isNonBlocking()) {
+ // Not to reset the message body
+ return resultMsg;
+ }
+
+ // FIXME: Should we fix the Operation model so that getOutputType
+ // returns DataType<DataType<T>>?
+ DataType<DataType> targetType =
+ new DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, targetOperation.getOutputType());
+
+ DataType<DataType> sourceType =
+ new DataTypeImpl<DataType>(DataBinding.IDL_OUTPUT, Object.class, sourceOperation.getOutputType());
+
+ if (resultMsg.isFault()) {
+
+ // FIXME: We need to figure out what fault type it is and then
+ // transform it
+ // back the source fault type
+ // throw new InvocationRuntimeException((Throwable) result);
+
+ if ((result instanceof Exception) && !(result instanceof RuntimeException)) {
+ // FIXME: How to match fault data to a fault type for the
+ // operation?
+
+ // If the result is from an InvocationTargetException look at
+ // the actual cause.
+ if (result instanceof InvocationTargetException) {
+ result = ((InvocationTargetException)result).getCause();
+ }
+ DataType targetDataType = null;
+ for (DataType exType : targetOperation.getFaultTypes()) {
+ if (((Class)exType.getPhysical()).isInstance(result)) {
+ if (result instanceof FaultException) {
+ if (((FaultException)result).isMatchingType(exType.getLogical())) {
+ targetDataType = exType;
+ break;
+ }
+ } else {
+ targetDataType = exType;
+ break;
+ }
+ }
+ }
+
+ if (targetDataType == null) {
+ // Not a business exception
+ return resultMsg;
+ }
+
+ DataType targetFaultType = getFaultType(targetDataType);
+ if (targetFaultType == null) {
+ throw new TransformationException("Target fault type cannot be resolved");
+ }
+
+ // FIXME: How to match a source fault type to a target fault
+ // type?
+ DataType sourceDataType = null;
+ DataType sourceFaultType = null;
+ for (DataType exType : sourceOperation.getFaultTypes()) {
+ DataType faultType = getFaultType(exType);
+ // Match by the QName (XSD element) of the fault type
+ if (faultType != null && targetFaultType.getLogical().equals(faultType.getLogical())) {
+ sourceDataType = exType;
+ sourceFaultType = faultType;
+ break;
+ }
+ }
+
+ if (sourceFaultType == null) {
+ throw new TransformationException("No matching source fault type is found");
+ }
+
+ Object newResult =
+ transformException(result, targetDataType, sourceDataType, targetFaultType, sourceFaultType);
+ if (newResult != result) {
+ resultMsg.setFaultBody(newResult);
+ }
+ }
+
+ } else {
+ assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result;
+
+ Object newResult = transform(result, targetType, sourceType, true);
+ if (newResult != result) {
+ resultMsg.setBody(newResult);
+ }
+ }
+
+ return resultMsg;
+ }
+
+ private Object transform(Object source, DataType sourceType, DataType targetType, boolean isResponse) {
+ if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
+ return source;
+ }
+ Map<String, Object> metadata = new HashMap<String, Object>();
+ metadata.put("source.operation", isResponse? targetOperation: sourceOperation);
+ metadata.put("target.operation", isResponse? sourceOperation: targetOperation);
+ return mediator.mediate(source, sourceType, targetType, metadata);
+ }
+
+ private DataType getFaultType(DataType exceptionType) {
+ // FIXME: We cannot assume the exception will have a databinding set
+ DataBinding targetDataBinding =
+ mediator.getDataBindings().getDataBinding(exceptionType.getDataBinding());
+ if (targetDataBinding == null) {
+ return null;
+ }
+ ExceptionHandler targetHandler = targetDataBinding.getExceptionHandler();
+ if (targetHandler == null) {
+ return null;
+ }
+ return targetHandler.getFaultType(exceptionType);
+ }
+
+ /**
+ * @param source The source exception
+ * @param sourceExType The data type for the source exception
+ * @param targetExType The data type for the target exception
+ * @param sourceType The fault type for the source
+ * @param targetType The fault type for the target
+ * @return
+ */
+ private Object transformException(Object source,
+ DataType sourceExType,
+ DataType targetExType,
+ DataType sourceType,
+ DataType targetType) {
+ if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
+ return source;
+ }
+ Map<String, Object> metadata = new HashMap<String, Object>();
+ metadata.put("source.operation", targetOperation);
+ metadata.put("target.operation", sourceOperation);
+
+ DataType<DataType> eSourceDataType =
+ new DataTypeImpl<DataType>("idl:fault", sourceExType.getPhysical(), sourceType);
+ DataType<DataType> eTargetDataType =
+ new DataTypeImpl<DataType>("idl:fault", targetExType.getPhysical(), targetType);
+
+ return mediator.mediate(source, eSourceDataType, eTargetDataType, metadata);
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..60f6de3b96
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.core.databinding.module.DataBindingModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java
new file mode 100644
index 0000000000..1c521af842
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.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.core.databinding.processor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingJavaInterfaceProcessorTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /**
+ * @throws InvalidServiceContractException
+ */
+ public final void testVisitInterface() throws InvalidInterfaceException {
+ DataBindingExtensionPoint registry = new DefaultDataBindingExtensionPoint();
+ DataBindingJavaInterfaceProcessor processor = new DataBindingJavaInterfaceProcessor(registry);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+
+ JavaInterface contract = javaFactory.createJavaInterface();
+ contract.setJavaClass(MockInterface.class);
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(contract);
+ Operation operation = new OperationImpl("call");
+ Operation operation1 = new OperationImpl("call1");
+ contract.getOperations().add(operation);
+ contract.getOperations().add(operation1);
+ contract.setRemotable(true);
+ processor.visitInterface(contract);
+ // Assert.assertEquals("org.w3c.dom.Node", contract.getDataBinding());
+ // Assert.assertEquals("org.w3c.dom.Node",
+ // contract.getOperations().get("call").getDataBinding());
+ // Assert.assertEquals("xml:string",
+ // contract.getOperations().get("call1").getDataBinding());
+ }
+
+ @DataBinding("org.w3c.dom.Node")
+ @Remotable
+ public static interface MockInterface {
+ Node call(Node msg);
+
+ @DataBinding("xml:string")
+ String call1(String msg);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java.fixme b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java.fixme
new file mode 100644
index 0000000000..ecae54188c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-databinding/src/test/java/org/apache/tuscany/core/databinding/transformers/IDLTransformerTestCase.java.fixme
@@ -0,0 +1,229 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.databinding.transformers;
+
+import static org.apache.tuscany.spi.databinding.DataBinding.IDL_INPUT;
+import static org.apache.tuscany.spi.databinding.DataBinding.IDL_OUTPUT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.impl.DataBindingRegistryImpl;
+import org.apache.tuscany.databinding.impl.MediatorImpl;
+import org.apache.tuscany.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.databinding.impl.TransformerRegistryImpl;
+import org.apache.tuscany.databinding.javabeans.DOMNode2JavaBeanTransformer;
+import org.apache.tuscany.databinding.javabeans.JavaBean2DOMNodeTransformer;
+import org.apache.tuscany.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.databinding.xml.Node2String;
+import org.apache.tuscany.databinding.xml.String2Node;
+import org.apache.tuscany.interfacedef.DataType;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.interfacedef.util.ElementInfo;
+import org.apache.tuscany.interfacedef.util.TypeInfo;
+import org.apache.tuscany.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.interfacedef.util.XMLType;
+import org.apache.tuscany.spi.databinding.DataBindingRegistry;
+import org.apache.tuscany.spi.databinding.TransformationContext;
+import org.apache.tuscany.spi.databinding.extension.DOMHelper;
+import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class IDLTransformerTestCase extends TestCase {
+ private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<order1"
+ + " 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>"
+ + "</order1>";
+
+ private static final String URI_ORDER_XSD = "http://example.com/order.xsd";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ List<DataType> types0 = new ArrayList<DataType>();
+ DataType<XMLType> wrapperType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD,
+ "checkOrderStatus"), null));
+ types0.add(wrapperType);
+ DataType<List<DataType>> inputType0 = new DataTypeImpl<List<DataType>>(IDL_INPUT,
+ Object[].class, types0);
+
+ List<DataType> types1 = new ArrayList<DataType>();
+ DataType<XMLType> customerIdType = new DataTypeImpl<XMLType>(
+ null,
+ Object.class,
+ new XMLType(
+ new QName(URI_ORDER_XSD, "customerId"),
+ null));
+ DataType<XMLType> orderType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD, "order"), null));
+ DataType<XMLType> flagType = new DataTypeImpl<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD,
+ "flag"), null));
+ types1.add(customerIdType);
+ types1.add(orderType);
+ types1.add(flagType);
+
+ DataType<XMLType> statusType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD, "status"), null));
+ DataType<XMLType> responseType = new DataTypeImpl<XMLType>(null, Object.class,
+ new XMLType(new QName(URI_ORDER_XSD,
+ "checkOrderStatusResponse"),
+ null));
+
+ Operation op = new OperationImpl("checkOrderStatus");
+ op.setInputType(inputType0);
+ op.setOutputType(responseType);
+// op.setDataBinding(DOMDataBinding.NAME);
+//
+// inputType0.setOperation(op);
+ op.setWrapperStyle(true);
+ ElementInfo inputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null,
+ false,
+ null));
+// wrapperType.setMetadata(ElementInfo.class.getName(), inputElement);
+
+ ElementInfo customerId = new ElementInfo(new QName("", "customerId"),
+ SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
+ ElementInfo order = new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
+ ElementInfo flag = new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));
+
+// customerIdType.setMetadata(ElementInfo.class.getName(), customerId);
+// orderType.setMetadata(ElementInfo.class.getName(), order);
+// flagType.setMetadata(ElementInfo.class.getName(), flag);
+//
+// customerIdType.setOperation(op);
+// orderType.setOperation(op);
+// flagType.setOperation(op);
+
+ List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
+ inputElements.add(customerId);
+ inputElements.add(order);
+ inputElements.add(flag);
+
+ ElementInfo statusElement = new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES
+ .get("string"));
+
+// statusType.setMetadata(ElementInfo.class.getName(), statusElement);
+// statusType.setOperation(op);
+
+ List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
+ outputElements.add(statusElement);
+
+ ElementInfo outputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"),
+ new TypeInfo(null, false, null));
+
+// responseType.setMetadata(ElementInfo.class.getName(), inputElement);
+// responseType.setOperation(op);
+
+ WrapperInfo wrapperInfo = new WrapperInfo(DOMDataBinding.NAME, inputElement, outputElement, inputElements,
+ outputElements);
+ op.setWrapper(wrapperInfo);
+// op.setDataBinding(DOMDataBinding.NAME);
+
+ MediatorImpl m = new MediatorImpl();
+ TransformerRegistryImpl tr = new TransformerRegistryImpl();
+ tr.registerTransformer(new String2Node());
+ tr.registerTransformer(new Node2String());
+ tr.registerTransformer(new DOMNode2JavaBeanTransformer());
+ tr.registerTransformer(new JavaBean2DOMNodeTransformer());
+ m.setTransformerRegistry(tr);
+ DataBindingRegistry dataBindingRegistry = new DataBindingRegistryImpl();
+ dataBindingRegistry.register(new DOMDataBinding());
+ m.setDataBindingRegistry(dataBindingRegistry);
+
+ Object[] source = new Object[] {"cust001", IPO_XML, Integer.valueOf(1)};
+ Input2InputTransformer t = new Input2InputTransformer();
+ t.setMediator(m);
+
+ TransformationContext context = new TransformationContextImpl();
+ context.setSourceOperation(op);
+ List<DataType<Class>> types = new ArrayList<DataType<Class>>();
+ types.add(new DataTypeImpl<Class>(Object.class.getName(), String.class, String.class));
+ types.add(new DataTypeImpl<Class>("java.lang.String", String.class, String.class));
+ types.add(new DataTypeImpl<Class>(Object.class.getName(), int.class, int.class));
+ DataType<List<DataType<Class>>> inputType1 = new DataTypeImpl<List<DataType<Class>>>(IDL_INPUT, Object[].class,
+ types);
+ context.setSourceDataType(inputType1);
+ context.setTargetDataType(op.getInputType());
+ Object[] results = t.transform(source, context);
+ assertEquals(1, results.length);
+ assertTrue(results[0] instanceof Element);
+ Element element = (Element)results[0];
+ assertEquals("http://example.com/order.xsd", element.getNamespaceURI());
+ assertEquals("checkOrderStatus", element.getLocalName());
+
+ TransformationContext context1 = new TransformationContextImpl();
+ DataType<DataType> sourceType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
+
+ context1.setSourceDataType(sourceType);
+ DataType<DataType> targetType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class,
+ new DataTypeImpl<Class>("java.lang.Object",
+ String.class, String.class));
+ context1.setTargetDataType(targetType);
+
+ Document factory = DOMHelper.newDocument();
+ Element responseElement = factory
+ .createElementNS("http://example.com/order.wsdl", "p:checkOrderStatusResponse");
+ Element status = factory.createElement("status");
+ responseElement.appendChild(status);
+ status.appendChild(factory.createTextNode("shipped"));
+ Output2OutputTransformer t2 = new Output2OutputTransformer();
+ t2.setMediator(m);
+ Object st = t2.transform(responseElement, context1);
+ assertEquals("shipped", st);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.pmd
new file mode 100644
index 0000000000..4abfdec2b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/.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/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/pom.xml
new file mode 100644
index 0000000000..50e04075b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/pom.xml
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core-spi</artifactId>
+ <name>Apache Tuscany SCA Core SPI</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-policy</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>true</attach>
+ <quiet>true</quiet>
+ <bottom>Apache Tuscany is an effort undergoing incubation at the Apache Software Foundation(ASF) and sponsored by the Apache WS PMC.</bottom>
+ <header>Apache Tuscany SCA Core SPI</header>
+ <footer>Apache Tuscany SCA Core SPI</footer>
+ <sourcepath>${basedir}/src/main/java${path.separator}${basedir}/target/generated/src/main/java</sourcepath>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/doc/Context Model.emx b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/doc/Context Model.emx
new file mode 100644
index 0000000000..0445ea5a6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/doc/Context Model.emx
@@ -0,0 +1,673 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<!--xtools2_universal_type_manager-->
+<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.ibm.com/xtools/1.5.0/Notation" xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML" xmlns:umlnotation="http://www.ibm.com/xtools/1.5.0/Umlnotation" xmi:id="_al1S8NovEdqRBPR5WyT36A" name="Context Model" appliedProfile="_al1S9NovEdqRBPR5WyT36A _al1S99ovEdqRBPR5WyT36A _al1S-tovEdqRBPR5WyT36A _al1S_dovEdqRBPR5WyT36A _al1TANovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S8dovEdqRBPR5WyT36A" source="uml2.diagrams" references="_al1S8tovEdqRBPR5WyT36A">
+ <contents xmi:type="notation:Diagram" xmi:id="_al1S8tovEdqRBPR5WyT36A" type="Class" name="Main">
+ <children xmi:id="_ePDcYdovEdqRBPR5WyT36A" sourceEdges="_Fd3lQdowEdqRBPR5WyT36A _R5Rjwdo1EdqRBPR5WyT36A _pdfmkNo2EdqRBPR5WyT36A" targetEdges="_hmIF4dovEdqRBPR5WyT36A _mu9A4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" element="_ePDcYNovEdqRBPR5WyT36A">
+ <children xmi:id="_ePJjANovEdqRBPR5WyT36A" type="ImageCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_ePJjAdovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_ePJjAtovEdqRBPR5WyT36A" type="Stereotype" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjA9ovEdqRBPR5WyT36A" type="Kind" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjBNovEdqRBPR5WyT36A" type="Name" element="_ePDcYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ePJjBdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjBtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ePJjB9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ePJjCdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ePDcYtovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ePDcY9ovEdqRBPR5WyT36A" x="6693" y="3545"/>
+ </children>
+ <children xmi:id="_fs1pANovEdqRBPR5WyT36A" sourceEdges="_hmIF4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" targetEdges="_xInjYdovEdqRBPR5WyT36A" element="_fsviYNovEdqRBPR5WyT36A">
+ <children xmi:id="_fs1pA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_fs1pBNovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_fs1pBdovEdqRBPR5WyT36A" type="Stereotype" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pBtovEdqRBPR5WyT36A" type="Kind" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pB9ovEdqRBPR5WyT36A" type="Name" element="_fsviYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_fs1pCNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pCdovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_fs1pCtovEdqRBPR5WyT36A" type="OperationCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pC9ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_fs1pDNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_fsviYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pDdovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_fs1pAdovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fs1pAtovEdqRBPR5WyT36A" x="2226" y="8268"/>
+ </children>
+ <children xmi:id="_ikr_4NovEdqRBPR5WyT36A" sourceEdges="_mu9A4dovEdqRBPR5WyT36A" element="_ikl5QNovEdqRBPR5WyT36A">
+ <children xmi:id="_ikr_49ovEdqRBPR5WyT36A" type="ImageCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_ikr_5NovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_ikr_5dovEdqRBPR5WyT36A" type="Stereotype" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_5tovEdqRBPR5WyT36A" type="Kind" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_59ovEdqRBPR5WyT36A" type="Name" element="_ikl5QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_ikr_6NovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_6dovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ikr_6tovEdqRBPR5WyT36A" type="OperationCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_69ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_ikr_7NovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_7dovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ikr_4dovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ikr_4tovEdqRBPR5WyT36A" x="9222" y="8268"/>
+ </children>
+ <children xmi:id="_tZF9odovEdqRBPR5WyT36A" sourceEdges="_xInjYdovEdqRBPR5WyT36A _BkUg0dowEdqRBPR5WyT36A" element="_tZF9oNovEdqRBPR5WyT36A">
+ <children xmi:id="_tZF9pNovEdqRBPR5WyT36A" type="ImageCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_tZF9pdovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_tZF9ptovEdqRBPR5WyT36A" type="Stereotype" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9p9ovEdqRBPR5WyT36A" type="Kind" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9qNovEdqRBPR5WyT36A" type="Name" element="_tZF9oNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_tZF9qdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9qtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_tZF9q9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_tZF9rdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_tZF9otovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_tZF9o9ovEdqRBPR5WyT36A" x="2226" y="12084"/>
+ </children>
+ <children xmi:id="_z_m-oNovEdqRBPR5WyT36A" sourceEdges="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_3Ic-4NovEdqRBPR5WyT36A _9XeF4tovEdqRBPR5WyT36A _Fd3lQdowEdqRBPR5WyT36A" element="_z_g4ANovEdqRBPR5WyT36A">
+ <children xmi:id="_z_m-o9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_z_m-pNovEdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_z_m-pdovEdqRBPR5WyT36A" type="Stereotype" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-ptovEdqRBPR5WyT36A" type="Kind" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-p9ovEdqRBPR5WyT36A" type="Name" element="_z_g4ANovEdqRBPR5WyT36A"/>
+ <children xmi:id="_z_m-qNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-qdovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_z_m-qtovEdqRBPR5WyT36A" type="OperationCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-q9ovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_z_m-rNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-rdovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_z_m-odovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_z_m-otovEdqRBPR5WyT36A" x="17172" y="6996"/>
+ </children>
+ <children xmi:id="_1y-ZsNovEdqRBPR5WyT36A" sourceEdges="_3Ic-4NovEdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" targetEdges="_BkUg0dowEdqRBPR5WyT36A" element="_1yyMcNovEdqRBPR5WyT36A">
+ <children xmi:id="_1y-Zs9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_1y-ZtNovEdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_1y-ZtdovEdqRBPR5WyT36A" type="Stereotype" element="_1yyMcNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_1y-ZttovEdqRBPR5WyT36A" type="Name" element="_1yyMcNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_1y-Zt9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZuNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-ZudovEdqRBPR5WyT36A" type="OperationCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZutovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-Zu9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZvNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_1y-ZvdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_1y-ZvtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_1y-ZsdovEdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1y-ZstovEdqRBPR5WyT36A" x="13992" y="12084"/>
+ </children>
+ <children xmi:id="_4WSrANovEdqRBPR5WyT36A" sourceEdges="_9XeF4tovEdqRBPR5WyT36A _9PaR4No2EdqRBPR5WyT36A" element="_4WMkYNovEdqRBPR5WyT36A">
+ <children xmi:id="_4WSrA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_4WSrBNovEdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_4WSrBdovEdqRBPR5WyT36A" type="Stereotype" element="_4WMkYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_4WSrBtovEdqRBPR5WyT36A" type="Name" element="_4WMkYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_4WSrB9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrCdovEdqRBPR5WyT36A" type="OperationCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCtovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrC9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrDNovEdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_4WSrDdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_4WSrDtovEdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_4WSrAdovEdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4WSrAtovEdqRBPR5WyT36A" x="19716" y="12084"/>
+ </children>
+ <children xmi:id="_o2m3oNo0EdqRBPR5WyT36A" targetEdges="_9PaR4No2EdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" element="_o2gxANo0EdqRBPR5WyT36A">
+ <children xmi:id="_o2m3o9o0EdqRBPR5WyT36A" type="ImageCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_o2m3pNo0EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_o2m3pdo0EdqRBPR5WyT36A" type="Stereotype" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3pto0EdqRBPR5WyT36A" type="Kind" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3p9o0EdqRBPR5WyT36A" type="Name" element="_o2gxANo0EdqRBPR5WyT36A"/>
+ <children xmi:id="_o2m3qNo0EdqRBPR5WyT36A" type="AttributeCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3qdo0EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_o2m3qto0EdqRBPR5WyT36A" type="OperationCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3q9o0EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_o2m3rNo0EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3rdo0EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_o2m3odo0EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_o2m3oto0EdqRBPR5WyT36A" x="23532" y="6996"/>
+ </children>
+ <children xmi:id="_M0FLkNo1EdqRBPR5WyT36A" targetEdges="_R5Rjwdo1EdqRBPR5WyT36A _V7zlEdo1EdqRBPR5WyT36A" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <children xmi:id="_M0FLk9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_M0FLlNo1EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_M0FLldo1EdqRBPR5WyT36A" type="Stereotype" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLlto1EdqRBPR5WyT36A" type="Kind" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLl9o1EdqRBPR5WyT36A" type="Name" element="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <children xmi:id="_M0FLmNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLmdo1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_M0FLmto1EdqRBPR5WyT36A" type="OperationCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLm9o1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_M0FLnNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLndo1EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_M0FLkdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_M0FLkto1EdqRBPR5WyT36A" x="6678" y="318"/>
+ </children>
+ <children xmi:id="_TJHbANo1EdqRBPR5WyT36A" sourceEdges="_V7zlEdo1EdqRBPR5WyT36A" targetEdges="_cN4xsdo2EdqRBPR5WyT36A" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <children xmi:id="_TJHbA9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_TJHbBNo1EdqRBPR5WyT36A" width="530" height="530"/>
+ </children>
+ <children xmi:id="_TJHbBdo1EdqRBPR5WyT36A" type="Stereotype" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbBto1EdqRBPR5WyT36A" type="Kind" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbB9o1EdqRBPR5WyT36A" type="Name" element="_TI7NwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_TJHbCNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbCdo1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_TJHbCto1EdqRBPR5WyT36A" type="OperationCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbC9o1EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_TJHbDNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbDdo1EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_TJHbAdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TJHbAto1EdqRBPR5WyT36A" x="16854" y="318"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLDiagramStyle" xmi:id="_al1S89ovEdqRBPR5WyT36A"/>
+ <edges xmi:id="_hmIF4dovEdqRBPR5WyT36A" element="_hmIF4NovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_hmIF5NovEdqRBPR5WyT36A" type="NameLabel" element="_hmIF4NovEdqRBPR5WyT36A">
+ <children xmi:id="_hmIF5tovEdqRBPR5WyT36A" type="Stereotype" element="_hmIF4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_hmIF59ovEdqRBPR5WyT36A" type="Name" element="_hmIF4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_hmIF5dovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_hmIF4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hmIF49ovEdqRBPR5WyT36A" points="[26, -31, -110, 148]$[140, -148, 4, 31]"/>
+ </edges>
+ <edges xmi:id="_mu9A4dovEdqRBPR5WyT36A" element="_mu9A4NovEdqRBPR5WyT36A" source="_ikr_4NovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_mu9A5NovEdqRBPR5WyT36A" type="NameLabel" element="_mu9A4NovEdqRBPR5WyT36A">
+ <children xmi:id="_mu9A5tovEdqRBPR5WyT36A" type="Stereotype" element="_mu9A4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_mu9A59ovEdqRBPR5WyT36A" type="Name" element="_mu9A4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_mu9A5dovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_mu9A4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mu9A49ovEdqRBPR5WyT36A" points="[-185, -820, 2937, 3916]$[-185, -3042, 2937, 1694]$[-3255, -3042, -133, 1694]$[-3255, -3916, -133, 820]"/>
+ </edges>
+ <edges xmi:id="_pe3jwNovEdqRBPR5WyT36A" element="_peM1YNovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jw9ovEdqRBPR5WyT36A" type="NameLabel" element="_peM1YNovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jxdovEdqRBPR5WyT36A" type="Stereotype" element="_peM1YNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_pe3jxtovEdqRBPR5WyT36A" type="Name" element="_peM1YNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jxNovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pe3jx9ovEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jydovEdqRBPR5WyT36A" type="ToMultiplicity" element="_peM1YtovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jyNovEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pe3jytovEdqRBPR5WyT36A" type="ToRoleLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jzNovEdqRBPR5WyT36A" type="ToRole" element="_peM1YtovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jy9ovEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pe3jzdovEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3jz9ovEdqRBPR5WyT36A" type="FromMultiplicity" element="_peM1YdovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jztovEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pe3j0NovEdqRBPR5WyT36A" type="FromRoleLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j0tovEdqRBPR5WyT36A" type="FromRole" element="_peM1YdovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j0dovEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pe3j09ovEdqRBPR5WyT36A" type="ToQualifierLabel" element="_peM1YtovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j1dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YtovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j1tovEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j1NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pe3j19ovEdqRBPR5WyT36A" type="FromQualifierLabel" element="_peM1YdovEdqRBPR5WyT36A">
+ <children xmi:id="_pe3j2dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YdovEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j2tovEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j2NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pe3jwdovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pe3jwtovEdqRBPR5WyT36A" points="[-317, -820, -3916, 3916]$[-1931, -4762, -5530, -26]$[2382, -4762, -1217, -26]"/>
+ </edges>
+ <edges xmi:id="_xInjYdovEdqRBPR5WyT36A" element="_xInjYNovEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_fs1pANovEdqRBPR5WyT36A">
+ <children xmi:id="_xInjZNovEdqRBPR5WyT36A" type="NameLabel" element="_xInjYNovEdqRBPR5WyT36A">
+ <children xmi:id="_xInjZtovEdqRBPR5WyT36A" type="Stereotype" element="_xInjYNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_xInjZ9ovEdqRBPR5WyT36A" type="Name" element="_xInjYNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_xInjZdovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_xInjYtovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_xInjY9ovEdqRBPR5WyT36A" points="[-4, -31, 1, 113]$[-4, -115, 1, 29]"/>
+ </edges>
+ <edges xmi:id="_3Ic-4NovEdqRBPR5WyT36A" element="_3IW4QNovEdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_3Ic-49ovEdqRBPR5WyT36A" type="NameLabel" element="_3IW4QNovEdqRBPR5WyT36A">
+ <children xmi:id="_3Ic-5dovEdqRBPR5WyT36A" type="Stereotype" element="_3IW4QNovEdqRBPR5WyT36A"/>
+ <children xmi:id="_3Ic-5tovEdqRBPR5WyT36A" type="Name" element="_3IW4QNovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_3Ic-5NovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_3Ic-4dovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3Ic-4tovEdqRBPR5WyT36A" points="[6, -24, -37, 154]$[-22, -170, -65, 8]"/>
+ </edges>
+ <edges xmi:id="_9XeF4tovEdqRBPR5WyT36A" element="_9XeF4NovEdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_9XeF5dovEdqRBPR5WyT36A" type="NameLabel" element="_9XeF4NovEdqRBPR5WyT36A">
+ <children xmi:id="_9XeF59ovEdqRBPR5WyT36A" type="Stereotype" element="_9XeF4NovEdqRBPR5WyT36A"/>
+ <children xmi:id="_9XeF6NovEdqRBPR5WyT36A" type="Name" element="_9XeF4NovEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9XeF5tovEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9XeF49ovEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9XeF5NovEdqRBPR5WyT36A" points="[-23, -23, 162, 151]$[-121, -170, 64, 4]"/>
+ </edges>
+ <edges xmi:id="_BkUg0dowEdqRBPR5WyT36A" element="_Bj8GUNowEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_1y-ZsNovEdqRBPR5WyT36A">
+ <children xmi:id="_BkancNowEdqRBPR5WyT36A" type="NameLabel" element="_Bj8GUNowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanctowEdqRBPR5WyT36A" type="Stereotype" element="_Bj8GUNowEdqRBPR5WyT36A"/>
+ <children xmi:id="_Bkanc9owEdqRBPR5WyT36A" type="Name" element="_Bj8GUNowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkancdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_BkandNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkandtowEdqRBPR5WyT36A" type="ToMultiplicity" element="_Bj8GUtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanddowEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Bkand9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanedowEdqRBPR5WyT36A" type="ToRole" element="_Bj8GUtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkaneNowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_BkanetowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanfNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_Bj8GUdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Bkane9owEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_BkanfdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_Bkanf9owEdqRBPR5WyT36A" type="FromRole" element="_Bj8GUdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanftowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_BkangNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <children xmi:id="_BkangtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUtowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkang9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkangdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_BkanhNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <children xmi:id="_BkanhtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUdowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkanh9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanhdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_BkUg0towEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_BkUg09owEdqRBPR5WyT36A" points="[83, -24, -490, 123]$[486, -151, -87, -4]"/>
+ </edges>
+ <edges xmi:id="_Fd3lQdowEdqRBPR5WyT36A" element="_FdlRYNowEdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lRNowEdqRBPR5WyT36A" type="NameLabel" element="_FdlRYNowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lRtowEdqRBPR5WyT36A" type="Stereotype" element="_FdlRYNowEdqRBPR5WyT36A"/>
+ <children xmi:id="_Fd3lR9owEdqRBPR5WyT36A" type="Name" element="_FdlRYNowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lRdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_Fd3lSNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lStowEdqRBPR5WyT36A" type="ToMultiplicity" element="_FdlRYtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lSdowEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Fd3lS9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lTdowEdqRBPR5WyT36A" type="ToRole" element="_FdlRYtowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lTNowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_Fd3lTtowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lUNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_FdlRYdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lT9owEdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_Fd3lUdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lU9owEdqRBPR5WyT36A" type="FromRole" element="_FdlRYdowEdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lUtowEdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_Fd3lVNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_FdlRYtowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lVtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYtowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lV9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lVdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_Fd3lWNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_FdlRYdowEdqRBPR5WyT36A">
+ <children xmi:id="_Fd3lWtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYdowEdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lW9owEdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lWdowEdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_Fd3lQtowEdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Fd3lQ9owEdqRBPR5WyT36A" points="[46, -11, -369, -9]$[351, -11, -64, -9]"/>
+ </edges>
+ <edges xmi:id="_R5Rjwdo1EdqRBPR5WyT36A" element="_R5RjwNo1EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
+ <children xmi:id="_R5RjxNo1EdqRBPR5WyT36A" type="NameLabel" element="_R5RjwNo1EdqRBPR5WyT36A">
+ <children xmi:id="_R5Rjxto1EdqRBPR5WyT36A" type="Stereotype" element="_R5RjwNo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_R5Rjx9o1EdqRBPR5WyT36A" type="Name" element="_R5RjwNo1EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_R5Rjxdo1EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_R5Rjwto1EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_R5Rjw9o1EdqRBPR5WyT36A" points="[-2, -31, -2, 91]$[-2, -91, -2, 31]"/>
+ </edges>
+ <edges xmi:id="_V7zlEdo1EdqRBPR5WyT36A" element="_V7zlENo1EdqRBPR5WyT36A" source="_TJHbANo1EdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
+ <children xmi:id="_V7zlFNo1EdqRBPR5WyT36A" type="NameLabel" element="_V7zlENo1EdqRBPR5WyT36A">
+ <children xmi:id="_V7zlFto1EdqRBPR5WyT36A" type="Stereotype" element="_V7zlENo1EdqRBPR5WyT36A"/>
+ <children xmi:id="_V7zlF9o1EdqRBPR5WyT36A" type="Name" element="_V7zlENo1EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_V7zlFdo1EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_V7zlEto1EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_V7zlE9o1EdqRBPR5WyT36A" points="[-73, 0, 339, 0]$[-457, 0, -45, 0]"/>
+ </edges>
+ <edges xmi:id="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_pdfmkNo2EdqRBPR5WyT36A" element="_cNskcNo2EdqRBPR5WyT36A" source="_z_m-oNovEdqRBPR5WyT36A" target="_TJHbANo1EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xtNo2EdqRBPR5WyT36A" type="NameLabel" element="_cNskcNo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xtto2EdqRBPR5WyT36A" type="Stereotype" element="_cNskcNo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_cN4xt9o2EdqRBPR5WyT36A" type="Name" element="_cNskcNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xtdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_cN4xuNo2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xuto2EdqRBPR5WyT36A" type="ToMultiplicity" element="_cNskcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xudo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_cN4xu9o2EdqRBPR5WyT36A" type="ToRoleLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN4xvdo2EdqRBPR5WyT36A" type="ToRole" element="_cNskcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xvNo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_cN_fYNo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fYto2EdqRBPR5WyT36A" type="FromMultiplicity" element="_cNskcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fYdo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_cN_fY9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fZdo2EdqRBPR5WyT36A" type="FromRole" element="_cNskcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZNo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_cN_fZto2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_cNskcto2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_faNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcto2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fado2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZ9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_cN_fato2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_cNskcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_cN_fbNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fbdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fa9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_cN4xsto2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cN4xs9o2EdqRBPR5WyT36A" points="[-2, -29, 1, 91]$[26, -89, 29, 31]"/>
+ </edges>
+ <edges xmi:id="_pdfmkNo2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_cN4xsdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfml9o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmmdo2EdqRBPR5WyT36A" type="ToMultiplicity" element="_pdTZUdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmmNo2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pdfmmto2EdqRBPR5WyT36A" type="ToRoleLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmnNo2EdqRBPR5WyT36A" type="ToRole" element="_pdTZUdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmm9o2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pdfmndo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmn9o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_pdTZUNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmnto2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_pdfmoNo2EdqRBPR5WyT36A" type="FromRoleLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmoto2EdqRBPR5WyT36A" type="FromRole" element="_pdTZUNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmodo2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_pdfmo9o2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmpdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmpto2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmpNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pdfmp9o2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmqdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUNo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmqto2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmqNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_pdfmq9o2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A">
+ <children xmi:id="_pdfmrto2EdqRBPR5WyT36A" type="ImageCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_pdfmr9o2EdqRBPR5WyT36A" width="1320" height="1320"/>
+ </children>
+ <children xmi:id="_pdfmsNo2EdqRBPR5WyT36A" type="Stereotype" element="_pdHMENo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_pdfmsdo2EdqRBPR5WyT36A" type="Name" element="_pdHMENo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_pdfmsto2EdqRBPR5WyT36A" type="AttributeCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfms9o2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmtNo2EdqRBPR5WyT36A" type="OperationCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmtdo2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmtto2EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmt9o2EdqRBPR5WyT36A"/>
+ </children>
+ <children xmi:id="_pdfmuNo2EdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_pdfmudo2EdqRBPR5WyT36A"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_pdfmrNo2EdqRBPR5WyT36A" showStereotype="Label"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pdfmrdo2EdqRBPR5WyT36A" y="1323"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pdfmkdo2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pdfmkto2EdqRBPR5WyT36A" points="[46, 3, -366, 94]$[412, -91, 0, 0]"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_pdrz0No2EdqRBPR5WyT36A" id="100"/>
+ </edges>
+ <edges xmi:id="_9PaR4No2EdqRBPR5WyT36A" element="_9PH-ANo2EdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR49o2EdqRBPR5WyT36A" type="NameLabel" element="_9PH-ANo2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR5do2EdqRBPR5WyT36A" type="Stereotype" element="_9PH-ANo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_9PaR5to2EdqRBPR5WyT36A" type="Name" element="_9PH-ANo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR5No2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9PaR59o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR6do2EdqRBPR5WyT36A" type="ToMultiplicity" element="_9PH-Ato2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR6No2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9PaR6to2EdqRBPR5WyT36A" type="ToRoleLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR7No2EdqRBPR5WyT36A" type="ToRole" element="_9PH-Ato2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR69o2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9PaR7do2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR79o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_9PH-Ado2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR7to2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9PaR8No2EdqRBPR5WyT36A" type="FromRoleLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PaR8to2EdqRBPR5WyT36A" type="FromRole" element="_9PH-Ado2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR8do2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9PgYgNo2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <children xmi:id="_9PgYgto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ato2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYg9o2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYgdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9PgYhNo2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <children xmi:id="_9PgYhto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ado2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYh9o2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYhdo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9PaR4do2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9PaR4to2EdqRBPR5WyT36A" points="[12, -24, -94, 162]$[80, -155, -26, 31]"/>
+ </edges>
+ <edges xmi:id="_9-BEUNo2EdqRBPR5WyT36A" element="_99uwcNo2EdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
+ <children xmi:id="_9-BEU9o2EdqRBPR5WyT36A" type="NameLabel" element="_99uwcNo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK8No2EdqRBPR5WyT36A" type="Stereotype" element="_99uwcNo2EdqRBPR5WyT36A"/>
+ <children xmi:id="_9-HK8do2EdqRBPR5WyT36A" type="Name" element="_99uwcNo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-BEVNo2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9-HK8to2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK9No2EdqRBPR5WyT36A" type="ToMultiplicity" element="_99uwcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK89o2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9-HK9do2EdqRBPR5WyT36A" type="ToRoleLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK99o2EdqRBPR5WyT36A" type="ToRole" element="_99uwcto2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK9to2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9-HK-No2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK-to2EdqRBPR5WyT36A" type="FromMultiplicity" element="_99uwcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK-do2EdqRBPR5WyT36A" y="397"/>
+ </children>
+ <children xmi:id="_9-HK-9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HK_do2EdqRBPR5WyT36A" type="FromRole" element="_99uwcdo2EdqRBPR5WyT36A"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_No2EdqRBPR5WyT36A" y="-397"/>
+ </children>
+ <children xmi:id="_9-HK_to2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_99uwcto2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HLANo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcto2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLAdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <children xmi:id="_9-HLAto2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_99uwcdo2EdqRBPR5WyT36A">
+ <children xmi:id="_9-HLBNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcdo2EdqRBPR5WyT36A">
+ <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLBdo2EdqRBPR5WyT36A"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HLA9o2EdqRBPR5WyT36A" y="-185"/>
+ </children>
+ <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9-BEUdo2EdqRBPR5WyT36A" showStereotype="Text"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9-BEUto2EdqRBPR5WyT36A" points="[49, -24, -290, 162]$[404, -163, 65, 23]"/>
+ </edges>
+ </contents>
+ </eAnnotations>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S9NovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S9dovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S9tovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S99ovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S-NovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S-dovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S-tovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S-9ovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S_NovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
+ <importedProfile href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S_dovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1S_tovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1S_9ovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
+ <importedProfile href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
+ </packageImport>
+ <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1TANovEdqRBPR5WyT36A">
+ <eAnnotations xmi:id="_al1TAdovEdqRBPR5WyT36A" source="attributes">
+ <details xmi:id="_al1TAtovEdqRBPR5WyT36A" key="version" value="0"/>
+ </eAnnotations>
+ <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
+ <importedProfile href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
+ </packageImport>
+ <packageImport xmi:id="_al1TA9ovEdqRBPR5WyT36A">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_EfRZoK86EdieaYgxtVWN8Q"/>
+ </packageImport>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_ePDcYNovEdqRBPR5WyT36A" name="Context">
+ <generalization xmi:id="_R5RjwNo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_FdlRYdowEdqRBPR5WyT36A" name="scopecontext" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_FdlRZNowEdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_FdlRY9owEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_fsviYNovEdqRBPR5WyT36A" name="CompositeContext">
+ <generalization xmi:id="_hmIF4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_peM1YdovEdqRBPR5WyT36A" name="context" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A" aggregation="composite">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_peM1ZNovEdqRBPR5WyT36A" value="-1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_peM1Y9ovEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_ikl5QNovEdqRBPR5WyT36A" name="AtomicContext">
+ <generalization xmi:id="_mu9A4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_peM1YNovEdqRBPR5WyT36A" memberEnd="_peM1YdovEdqRBPR5WyT36A _peM1YtovEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_peM1YtovEdqRBPR5WyT36A" visibility="private" type="_fsviYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_tZF9oNovEdqRBPR5WyT36A" name="DeploymentContext">
+ <generalization xmi:id="_xInjYNovEdqRBPR5WyT36A" general="_fsviYNovEdqRBPR5WyT36A"/>
+ <ownedAttribute xmi:id="_Bj8GUdowEdqRBPR5WyT36A" name="modulescopecontext" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Bj8GVNowEdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Bj8GU9owEdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_z_g4ANovEdqRBPR5WyT36A" name="ScopeContext">
+ <ownedAttribute xmi:id="_cNskcdo2EdqRBPR5WyT36A" name="instancewrapper" visibility="private" type="_TI7NwNo1EdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cNskdNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cNskc9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Class" xmi:id="_1yyMcNovEdqRBPR5WyT36A" name="ModuleScopeContext" clientDependency="_3IW4QNovEdqRBPR5WyT36A">
+ <implementation xmi:id="_3IW4QNovEdqRBPR5WyT36A" client="_1yyMcNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
+ <mapping xmi:id="_3IW4QdovEdqRBPR5WyT36A"/>
+ </implementation>
+ <ownedAttribute xmi:id="_99uwcdo2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_99uwdNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_99uwc9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Class" xmi:id="_4WMkYNovEdqRBPR5WyT36A" name="HTTPSessionScopeContext" clientDependency="_9XeF4NovEdqRBPR5WyT36A">
+ <implementation xmi:id="_9XeF4NovEdqRBPR5WyT36A" client="_4WMkYNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
+ <mapping xmi:id="_9XeF4dovEdqRBPR5WyT36A"/>
+ </implementation>
+ <ownedAttribute xmi:id="_9PH-Ado2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A">
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_9PH-BNo2EdqRBPR5WyT36A" value="1"/>
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_9PH-A9o2EdqRBPR5WyT36A"/>
+ </ownedAttribute>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_Bj8GUNowEdqRBPR5WyT36A" memberEnd="_Bj8GUdowEdqRBPR5WyT36A _Bj8GUtowEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_Bj8GUtowEdqRBPR5WyT36A" visibility="private" type="_tZF9oNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_FdlRYNowEdqRBPR5WyT36A" memberEnd="_FdlRYdowEdqRBPR5WyT36A _FdlRYtowEdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_FdlRYtowEdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_o2gxANo0EdqRBPR5WyT36A" name="ScopeRegistry"/>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_Mz_E8No1EdqRBPR5WyT36A" name="Lifecycle"/>
+ <ownedMember xmi:type="uml:Interface" xmi:id="_TI7NwNo1EdqRBPR5WyT36A" name="InstanceWrapper">
+ <generalization xmi:id="_V7zlENo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_cNskcNo2EdqRBPR5WyT36A" memberEnd="_cNskcdo2EdqRBPR5WyT36A _cNskcto2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_cNskcto2EdqRBPR5WyT36A" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:AssociationClass" xmi:id="_pdHMENo2EdqRBPR5WyT36A" name="AssociationClass1" memberEnd="_pdTZUNo2EdqRBPR5WyT36A _pdTZUdo2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_pdTZUNo2EdqRBPR5WyT36A" visibility="private" type="_cNskcNo2EdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
+ <ownedEnd xmi:id="_pdTZUdo2EdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_9PH-ANo2EdqRBPR5WyT36A" memberEnd="_9PH-Ado2EdqRBPR5WyT36A _9PH-Ato2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_9PH-Ato2EdqRBPR5WyT36A" visibility="private" type="_4WMkYNovEdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+ <ownedMember xmi:type="uml:Association" xmi:id="_99uwcNo2EdqRBPR5WyT36A" memberEnd="_99uwcdo2EdqRBPR5WyT36A _99uwcto2EdqRBPR5WyT36A">
+ <ownedEnd xmi:id="_99uwcto2EdqRBPR5WyT36A" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A"/>
+ </ownedMember>
+</uml:Model>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
new file mode 100644
index 0000000000..7a42300098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.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.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * Default implementation of a registry to hold all the Tuscany core extension
+ * points. As the point of contact for all extension artifacts this registry
+ * allows loaded extensions to find all other parts of the system and
+ * register themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultExtensionPointRegistry implements ExtensionPointRegistry {
+ private Map<Class<?>, Object> extensionPoints = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add an extension point to the registry. This default implementation
+ * stores extensions against the interfaces that they implement.
+ * @param extensionPoint The instance of the extension point
+ */
+ public void addExtensionPoint(Object extensionPoint) {
+ Class[] interfaces = extensionPoint.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ extensionPoints.put(interfaces[i], extensionPoint);
+ }
+ }
+
+ /**
+ * Get the extension point by the interface that it implements
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ public <T> T getExtensionPoint(Class<T> extensionPointType) {
+ return extensionPointType.cast(extensionPoints.get(extensionPointType));
+ }
+
+ /**
+ * Remove an extension point based on the interface that it implements
+ * @param extensionPoint The extension point to remove
+ */
+ public void removeExtensionPoint(Object extensionPoint) {
+ Class[] interfaces = extensionPoint.getClass().getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ extensionPoints.remove(interfaces[i]);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..6765a6c8f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/DefaultModelFactoryExtensionPoint.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.sca.core;
+
+import java.util.HashMap;
+
+/**
+ * Default implementation of a model factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint {
+
+ private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ public void addFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.put(interfaces[i], factory);
+ }
+ }
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ public void removeFactory(Object factory) {
+ Class[] interfaces = factory.getClass().getInterfaces();
+ for (int i = 0; i<interfaces.length; i++) {
+ factories.remove(interfaces[i]);
+ }
+ }
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface The lookup key (factory interface)
+ * @return The factory
+ */
+ public <T> T getFactory(Class<T> factoryInterface) {
+ Object factory = factories.get(factoryInterface);
+ return factoryInterface.cast(factory);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
new file mode 100644
index 0000000000..9609487080
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.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.core;
+
+
+/**
+ * The registry for the Tuscany core extension points. As the point of contact
+ * for all extension artifacts this registry allows loaded extensions to find
+ * all other parts of the system and register themselves appropriately.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExtensionPointRegistry {
+
+ /**
+ * Add an extension point to the registry
+ * @param extensionPoint The instance of the extension point
+ */
+ void addExtensionPoint(Object extensionPoint);
+
+ /**
+ * Get the extension point by the interface
+ * @param extensionPointType The lookup key (extension point interface)
+ * @return The instance of the extension point
+ */
+ <T> T getExtensionPoint(Class<T> extensionPointType);
+
+ /**
+ * Remove an extension point
+ * @param extensionPoint The extension point to remove
+ */
+ void removeExtensionPoint(Object extensionPoint);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.java
new file mode 100644
index 0000000000..64706c6efc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModelFactoryExtensionPoint.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.core;
+
+/**
+ * An extension point for model factories. Model factories are provided to
+ * abstract the classes that represent artifacts in the assembly model away
+ * from their creation mechanism. When the runtime needs to extend the model
+ * as it reads in contributed artifacts it looks up the factory for the
+ * artifact required in this registry
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModelFactoryExtensionPoint {
+
+ /**
+ * Add a model factory extension.
+ *
+ * @param factory The factory to add
+ */
+ void addFactory(Object factory);
+
+ /**
+ * Remove a model factory extension.
+ *
+ * @param factory The factory to remove
+ */
+ void removeFactory(Object factory);
+
+ /**
+ * Get a factory implementing the given interface.
+ * @param factoryInterface the lookup key (factory interface)
+ * @return The factory
+ */
+ <T> T getFactory(Class<T> factoryInterface);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
new file mode 100644
index 0000000000..0244862309
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.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.core;
+
+
+/**
+ * ModuleActivator represents a module that plugs into the Tuscany system. Each
+ * module should provide an implementation of this interface and register the
+ * ModuleActivator implementation class by defining a file named
+ *
+ * "META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator"
+ *
+ * The content of the file is the class name of the ModuleActivator implementation.
+ * The implementation class must have a no-arg constructor. The same instance
+ * will be used to invoke all the methods during different phases of the module
+ * activation. Note that the start and stop methods defined by this interface
+ * take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This
+ * gives the ModuleActivator the oppotunity to add extension points to the
+ * registry as it is requested to start up and remove them when it is requested
+ * to shut down.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ModuleActivator {
+ /**
+ * Get a map of the extension points defined by this module. The key is the
+ * java interface to represent the extension point and the the value is the
+ * instance of the implementation of the interface.
+ *
+ * @return All the extension points defined by this module
+ */
+ Object[] getExtensionPoints();
+
+ /**
+ * This method is invoked when the module is started by the Tuscany system.
+ * It can be used by this module to registr extensions against extension
+ * points.
+ *
+ * @param registry The extension point registry
+ */
+ void start(ExtensionPointRegistry registry);
+
+ /**
+ * This method is invoked when the module is stopped by the Tuscany system.
+ * It can be used by this module to unregister extensions against the
+ * extension points.
+ *
+ * @param registry The extension point registry
+ */
+ void stop(ExtensionPointRegistry registry);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
new file mode 100644
index 0000000000..6a0c44a404
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.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.event;
+
+/**
+ * The base interface for events that are propagated in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface Event {
+
+ /**
+ * Returns the source of the event
+ */
+ Object getSource();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
new file mode 100644
index 0000000000..c116be921c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.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.event;
+
+/**
+ * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event
+ * @param event Returns true if the event matches implemented criteria
+ * @return Match result
+ */
+ boolean match(Event event);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
new file mode 100644
index 0000000000..b0debc36c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.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.event;
+
+/**
+ * Publishes events in the runtime by accepting {@link Event} objects and
+ * forwarding them to all registered {@link RuntimeEventListener} objects.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface EventPublisher {
+
+ /**
+ * Publish an event to all regisitered listeners
+ * @param object The event to publich
+ */
+ void publish(Event object);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param listener The listener to add
+ */
+ void addListener(RuntimeEventListener listener);
+
+ /**
+ * Registers a listener to receive notifications for the context
+ * @param filter The filter that will be applied before the lister is called
+ * @param listener The lister to add
+ */
+ void addListener(EventFilter filter, RuntimeEventListener listener);
+
+
+ /**
+ * Removes a previously registered listener
+ * @param listener The listener to remove
+ */
+ void removeListener(RuntimeEventListener listener);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
new file mode 100644
index 0000000000..b34dceee62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.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.event;
+
+import java.util.EventListener;
+
+/**
+ * Listeners observe events fired in the SCA runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeEventListener extends EventListener {
+
+ /**
+ * Accepts and event and acts on it
+ * @param event The event to act on
+ */
+ void onEvent(Event event);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
new file mode 100644
index 0000000000..ca0f4889a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.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.event;
+
+/**
+ * An event filter that always returns a true condition
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TrueFilter implements EventFilter {
+
+ /**
+ * Performs the actual evaluation on an event. Always returns true
+ * in this case
+ * @param event The incoming event which is ignored
+ * @return true
+ */
+ public boolean match(Event event) {
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java
new file mode 100644
index 0000000000..a5f221fc11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.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.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Interceptor extends Invoker {
+
+ /**
+ * Sets the next invoker
+ * @param next The next invoker
+ */
+ void setNext(Invoker next);
+
+ /**
+ * Returns the next invoker or null
+ * @return The next Invoker
+ */
+ Invoker getNext();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
new file mode 100644
index 0000000000..cd75d06ab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.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.invocation;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * A wire consists of 1..n invocation chains associated with the operations of its source service contract.
+ * <p/>
+ * Invocation chains may contain </code>Interceptors</code> that process invocations.
+ * <p/>
+ * A <code>Message</code> is used to pass data associated with an invocation through the chain.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InvocationChain {
+ /**
+ * Returns the target operation for this invocation chain.
+ *
+ * @return The target operation for this invocation chain
+ */
+ Operation getTargetOperation();
+
+ /**
+ * Returns the source operation for this invocation chain.
+ *
+ * @return The source operation for this invocation chain
+ */
+ Operation getSourceOperation();
+
+ /**
+ * Adds an interceptor to the chain
+ *
+ * @param interceptor The interceptor to add
+ */
+ void addInterceptor(Interceptor interceptor);
+
+ /**
+ * Adds an invoker to the chain
+ *
+ * @param invoker The invoker to add
+ */
+ void addInvoker(Invoker invoker);
+
+ /**
+ * Returns the first invoker in the chain.
+ *
+ * @return The first invoker in the chain
+ */
+ Invoker getHeadInvoker();
+
+ /**
+ * Returns the last invoker in the chain.
+ *
+ * @return The last invoker in the chain
+ */
+ Invoker getTailInvoker();
+
+ /**
+ * Adds an interceptor at the given position in the interceptor stack
+ *
+ * @param index The position in the interceptor stack to add the interceptor
+ * @param interceptor The interceptor to add
+ */
+ void addInterceptor(int index, Interceptor interceptor);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java
new file mode 100644
index 0000000000..2748bbed9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.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.invocation;
+
+/**
+ * Synchronous mediation associated with a client- or target- side wire.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Invoker {
+
+ /**
+ * Process a synchronous wire
+ *
+ * @param msg The request Message for the wire
+ * @return The response Message from the wire
+ */
+ Message invoke(Message msg);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
new file mode 100644
index 0000000000..ef23118e78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.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.sca.invocation;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * Represents a request, response, or exception flowing through a wire
+ *
+ * @version $Rev $Date
+ */
+public interface Message {
+
+ /**
+ * Returns the body of the message, which will be the payload or parameters associated with the wire
+ * @return The body of the message
+ */
+ <T> T getBody();
+
+ /**
+ * Sets the body of the message.
+ * @param body The body of the message
+ */
+ <T> void setBody(T body);
+
+ /**
+ * Get the conversation id
+ * @return The conversation ID
+ */
+ String getConversationID();
+
+ /**
+ * Set the conversation id
+ * @param conversationId The conversation ID
+ */
+ void setConversationID(String conversationId);
+
+ /**
+ * Get the end point reference of the source reference
+ * @return The end point reference of the reference originating the message
+ */
+ EndpointReference getFrom();
+
+ /**
+ * Set the end point reference of the reference originating the message
+ * @param from The end point reference of the reference originating the message
+ */
+ void setFrom(EndpointReference from);
+
+ /**
+ * Get the end point reference of target service
+ * @return The end point reference of the service that the message targets
+ */
+ EndpointReference getTo();
+
+ /**
+ * Set the end point reference of target service
+ * @param to The end point reference of the service that the message targets
+ */
+ void setTo(EndpointReference to);
+
+ /**
+ * Returns the id of the message
+ * @return The message Id
+ */
+ Object getMessageID();
+
+ /**
+ * Sets the id of the message
+ * @param messageId The message ID
+ */
+ void setMessageID(Object messageId);
+
+ /**
+ * Returns the correlation id of the message or null if one is not available. Correlation ids are used by transports
+ * for message routing.
+ * @return The correlation Id
+ */
+ Object getCorrelationID();
+
+ /**
+ * Sets the correlation id of the message. Correlation ids are used by transports for message routing.
+ * @param correlationId The correlation Id
+ */
+ void setCorrelationID(Object correlationId);
+
+ /**
+ * Determines if the message represents a fault/exception
+ *
+ * @return true If the message body is a fault object, false if the body is a normal payload
+ */
+ boolean isFault();
+
+ /**
+ * Set the message body with a fault object. After this method is called, isFault() returns true.
+ *
+ * @param fault The fault object represents an exception
+ */
+ <T> void setFaultBody(T fault);
+
+ /**
+ * Returns the conversational sequence the message is associated with, NONE, START, CONTINUE, or END on TargetInvoker}
+ *
+ * @return The conversational sequence the message is associated with
+ */
+ ConversationSequence getConversationSequence();
+
+ /**
+ * Returns the conversational sequence the message is associated with, NONE, START, CONTINUE, or END
+ *
+ * @param sequence The conversational sequence
+ */
+ void setConversationSequence(ConversationSequence sequence);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
new file mode 100644
index 0000000000..c2a9c488b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.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.invocation;
+
+
+/**
+ * A factory for messages
+ *
+ * @version $Rev $Date
+ */
+public interface MessageFactory {
+
+ /**
+ * Creates a new message.
+ *
+ * @return The new message
+ */
+ Message createMessage();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
new file mode 100644
index 0000000000..3626e16425
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.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.management;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Interface for the management service abstraction. The implementaion
+ * could be based on a variety of technologies including JMX, WSDM,
+ * SNMP etc.
+ *
+ * @version $Revision$ $Date$
+ */
+public interface ManagementService {
+
+ /**
+ * Registers a component for management.
+ *
+ * @param name Name of the component.
+ * @param component Component to be registered.
+ */
+ void registerComponent(String name, RuntimeComponent component);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
new file mode 100644
index 0000000000..0f6a932c51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.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.provider;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A factory for creating the runtime artifacts that represent bindings.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BindingProviderFactory<M extends Binding> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new reference binding provider for the given component and
+ * reference.
+ *
+ * @param component The runtime component
+ * @param reference The reference on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ M binding);
+
+ /**
+ * Creates a new service binding provider for the given component and
+ * service.
+ *
+ * @param component The runtime component
+ * @param service The service on the runtime component
+ * @param binding The binding assembly model object
+ * @return The binding provider
+ */
+ ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ M binding);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..1adb9287f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.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.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Default implementation of a provider factory extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExtensionPoint {
+
+ protected final Map<Class<?>, ProviderFactory> providerFactories =
+ new HashMap<Class<?>, ProviderFactory>();
+
+ /**
+ * The default constructor. Does nothing.
+ *
+ */
+ public DefaultProviderFactoryExtensionPoint() {
+ }
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void addProviderFactory(ProviderFactory providerFactory) {
+ providerFactories.put(providerFactory.getModelType(), providerFactory);
+ }
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ public void removeProviderFactory(ProviderFactory providerFactory) {
+ providerFactories.remove(providerFactory.getModelType());
+ }
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ public ProviderFactory getProviderFactory(Class<?> modelType) {
+ Class<?>[] classes = modelType.getInterfaces();
+ for (Class<?> c : classes) {
+ ProviderFactory factory = providerFactories.get(c);
+ if (factory != null) {
+ return factory;
+ }
+ }
+ return providerFactories.get(modelType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
new file mode 100644
index 0000000000..a680277b99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * A component implementation can implement this interface in order to tie
+ * into the Tuscany runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProvider {
+
+ /**
+ * This method will be invoked when the component implementation
+ * is activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component implementation
+ * is deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the component implementation in the invocation
+ * chain. The invoker will be responsible for calling the implementation
+ * logic for the given component.
+ *
+ * @param service The component service
+ * @param operation The operation that the interceptor will handle
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(RuntimeComponentService service, Operation operation);
+
+ /**
+ * Create an invoker to call back to the given component
+ * @param operation The operation
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createCallbackInvoker(Operation operation);
+
+ // InterfaceContract getImplementationInterfaceContract(RuntimeComponentService service);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java
new file mode 100644
index 0000000000..6a37d1e951
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.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.sca.provider;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * An interface for factories that create implementation providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ImplementationProviderFactory<M extends Implementation> extends ProviderFactory<M> {
+
+ /**
+ * Creates a new implementation provider for the given
+ * component.
+ *
+ * @param component The runtime component
+ * @param Implementation The implementation type
+ * @return The implementation provider
+ */
+ ImplementationProvider createImplementationProvider(RuntimeComponent component, M Implementation);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java
new file mode 100644
index 0000000000..2102806881
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.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.provider;
+
+/**
+ * A factory for runtime providers.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactory<M> {
+
+ /**
+ * The model type that this factory creates providers for.
+ *
+ * @return the model type
+ */
+ Class<M> getModelType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
new file mode 100644
index 0000000000..5e781dd5b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.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.provider;
+
+
+/**
+ * An extension point for provider factories. Holds all of the provider
+ * factories from loaded extension points. Allows a provider factory
+ * to be located based on a given model type. Hence the runtime can
+ * generate runtime artifacts from the in memory assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProviderFactoryExtensionPoint {
+
+
+ /**
+ * Add a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void addProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Remove a provider factory.
+ *
+ * @param providerFactory The provider factory
+ */
+ void removeProviderFactory(ProviderFactory providerFactory);
+
+ /**
+ * Returns the provider factory associated with the given model type.
+ * @param modelType A model type
+ * @return The provider factory associated with the given model type
+ */
+ ProviderFactory getProviderFactory(Class<?> modelType);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
new file mode 100644
index 0000000000..4da4108168
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+/**
+ * A reference binding implementation can options implement this
+ * interface to tie into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ReferenceBindingProvider {
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component reference binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Create an invoker for the reference binding in the invocation chain. The
+ * invoker is responsible for making the outbound invocation over the
+ * binding protocol.
+ *
+ * @param operation The operation that the interceptor will handle
+ * @param isCallback A flag to tell if the operation is for the callback
+ * @return An invoker that handles the invocation logic, null should be
+ * returned if no invoker is required
+ */
+ Invoker createInvoker(Operation operation, boolean isCallback);
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component reference will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
new file mode 100644
index 0000000000..d2646d8d00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.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.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * A service binding can optionally implement this interface to tie
+ * into the Tuscany SCA runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServiceBindingProvider {
+ /**
+ * This method will be invoked when the component service binding is
+ * activated.
+ */
+ void start();
+
+ /**
+ * This method will be invoked when the component service binding is
+ * deactivated.
+ */
+ void stop();
+
+ /**
+ * Get the effective interface contract imposed by the binding. For example,
+ * it will be interface contract introspected from the WSDL portType used by
+ * the endpoint for a WebService binding.
+ *
+ * @return The effective interface contract, if null is returned, the
+ * interface contract for the component service will be used
+ */
+ InterfaceContract getBindingInterfaceContract();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..851afee3c1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.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;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * The default implementation of a <code>WireProcessorExtensionPoint</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWireProcessorExtensionPoint implements RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * The list of WireProcessors available to the runtime
+ */
+ private final List<RuntimeWireProcessor> processors = new ArrayList<RuntimeWireProcessor>();
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ public void addWireProcessor(RuntimeWireProcessor processor) {
+ processors.add(processor);
+ }
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ public void removeWireProcessor(RuntimeWireProcessor processor) {
+ processors.remove(processor);
+ }
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ public List<RuntimeWireProcessor> getWireProcessors() {
+ return processors;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
new file mode 100644
index 0000000000..627180b2d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.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.runtime;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * The endpoint reference for a component service or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EndpointReference {
+ /**
+ * Get the component for the endpoint
+ * @return The component, null of the EPR is for a non-SCA service
+ */
+ RuntimeComponent getComponent();
+
+ /**
+ * Get the component service or reference for the endpoint
+ * @return The component service or reference, null if the EPR is for a non-SCA service
+ */
+ Contract getContract();
+
+ /**
+ * Get the binding for the endpoint
+ * @return The binding
+ */
+ Binding getBinding();
+
+ //FIXME Why do we need this? isn't the interface contract already on the Contract?
+
+ /**
+ * Get the interface contract for the endpoint
+ * @return The interface contract
+ */
+ InterfaceContract getInterfaceContract();
+
+ /**
+ * Get the URI for this endpoint
+ * @return The URI of the endpoint
+ */
+ String getURI();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
new file mode 100644
index 0000000000..ddb5ae746c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.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.runtime;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * The runtime component interface. Provides the bridge between the
+ * assembly model representation of a component and its runtime
+ * realization.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponent extends Component, ComponentContext {
+ /**
+ * Set the implementation-specific configuration for this component
+ * @param implementationProvider The object that manages the component implementation
+ */
+ void setImplementationProvider(ImplementationProvider implementationProvider);
+
+ /**
+ * Get the implementation-specific configuation for this component
+ * @return The implementation provider for this component
+ */
+ ImplementationProvider getImplementationProvider();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
new file mode 100644
index 0000000000..18166d8c1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.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.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+
+/**
+ * The runtime component reference. Provides the bridge between the
+ * assembly model representation of a component reference and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentReference extends ComponentReference {
+
+ /**
+ * Get a list of runtime wires to the reference
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Returns the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime reference binding provider
+ */
+ ReferenceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Sets the reference binding provider associated with this
+ * component reference and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime reference binding provider
+ */
+ void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
+
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime Invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
new file mode 100644
index 0000000000..19327321a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.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.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+
+/**
+ * The runtime component service. Provides the bridge between the
+ * assembly model representation of a component service and its runtime
+ * realization
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeComponentService extends ComponentService {
+
+ /**
+ * Get a list of runtime wires to the service
+ *
+ * @return The list of wires
+ */
+ List<RuntimeWire> getRuntimeWires();
+ /**
+ * Get the runtime wire for the given binding
+ * @param binding The assembly model binding
+ * @return The runtime wire
+ */
+ RuntimeWire getRuntimeWire(Binding binding);
+
+ /**
+ * Get the callback wires assoicated with this service
+ *
+ * @return The list of runtime callback wires
+ */
+ List<RuntimeWire> getCallbackWires();
+
+ /**
+ * Returns the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @return The runtime service binding provider
+ */
+ ServiceBindingProvider getBindingProvider(Binding binding);
+
+ /**
+ * Sets the service binding provider associated with this
+ * component service and the given binding.
+ *
+ * @param binding The assembly model binding
+ * @param bindingProvider The runtime service binding provider
+ */
+ void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
+
+ /**
+ * Get the invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime invoker
+ */
+ Invoker getInvoker(Binding binding, Operation operation);
+
+ /**
+ * Get the callback invoker for the given binding and operation
+ * @param binding The assembly model binding
+ * @param operation The assembly model operation
+ * @return The runtime callback invoker
+ */
+ Invoker getCallbackInvoker(Binding binding, Operation operation);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
new file mode 100644
index 0000000000..d6b56d822e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.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.sca.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.invocation.InvocationChain;
+
+/**
+ * The runtime wire interface that connects a component reference to a
+ * component service (or an external service) over the selected binding
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWire {
+
+ /**
+ * Get the source of the wire
+ *
+ * @return The end point reference of the source
+ */
+ EndpointReference getSource();
+
+ /**
+ * Get the target of the wire
+ *
+ * @return The end point reference of the target
+ */
+ EndpointReference getTarget();
+
+ /**
+ * Returns the invocation chains for service operations associated with the
+ * wire
+ *
+ * @return the invocation chains for service operations associated with the
+ * wire
+ */
+ List<InvocationChain> getInvocationChains();
+
+ /**
+ * Returns the invocation chains for callback service operations associated
+ * with the wire
+ *
+ * @return the invocation chains for callback service operations associated
+ * with the wire
+ */
+ List<InvocationChain> getCallbackInvocationChains();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
new file mode 100644
index 0000000000..fbb7aae467
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.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;
+
+/**
+ * Implementations are called after wires are decorated with policy and before they are connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessor {
+
+ /**
+ * Process the runtime wire to add interceptors
+ *
+ * @param wire
+ */
+ void process(RuntimeWire wire);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
new file mode 100644
index 0000000000..4b2c71b397
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.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.sca.runtime;
+
+import java.util.List;
+
+/**
+ * Acts as a delegating <code>WireProcessorExtensionPoint</code>, delegating
+ * processing of wires after policies have been applied and source and targets
+ * have been connected.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RuntimeWireProcessorExtensionPoint {
+
+ /**
+ * Registers a wire-processor in the runtime
+ *
+ * @param processor The processor to register
+ */
+ void addWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * De-registers a wire-processor in the runtime
+ *
+ * @param processor The processor to de-register
+ */
+ void removeWireProcessor(RuntimeWireProcessor processor);
+
+ /**
+ * Returns a list of registered wire-processors.
+ *
+ * @return The list of wire processors
+ */
+ List<RuntimeWireProcessor> getWireProcessors();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
new file mode 100644
index 0000000000..3cf82982dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.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.store;
+
+/**
+ * thrown when a record already exists during an insert operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateRecordException extends StoreWriteException {
+ private static final long serialVersionUID = 3116253222569378447L;
+
+ public DuplicateRecordException() {
+ super();
+ }
+
+ public DuplicateRecordException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public DuplicateRecordException(String message) {
+ super(message);
+ }
+
+ public DuplicateRecordException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
new file mode 100644
index 0000000000..9d965a3369
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.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.store;
+
+import java.util.UUID;
+
+/**
+ * Implementations receive callback events during a store recovery operation
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RecoveryListener {
+
+ /**
+ * Signals the start of a recovery
+ */
+ void onBegin();
+
+ /**
+ * Received when a record is recovered
+ *
+ * @param id
+ */
+ void onRecord(UUID id);
+
+ /**
+ * Signals the end of recovery
+ */
+ void onEnd();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
new file mode 100644
index 0000000000..b15cde066a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.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.sca.store;
+
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be
+ * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an
+ * in-memory map.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Store extends EventPublisher {
+
+ /* Used to indicate an the default expiration offset for records for the store */
+ long DEFAULT_EXPIRATION_OFFSET = -1;
+
+ /* Used to indicate an entry should not expire */
+ long NEVER = -2;
+
+ /**
+ * Adds the given record to the store. Implementations may choose different strategies for writing data such as
+ * write-through or write-behind.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException if an error occurs during the write operation
+ */
+ void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Updates a given record in the store, overwriting previous information.
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @param object the object representing the data to write
+ * @param expiration the time in milliseconds when the entry expires
+ * @throws StoreWriteException
+ */
+ void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
+
+ /**
+ * Returns the deserialized object in the store corresponding to the given id
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @return the deserialized object or null if one is not found
+ * @throws StoreReadException
+ */
+ Object readRecord(RuntimeComponent owner, String id) throws StoreReadException;
+
+ /**
+ * Removes a record from the store
+ *
+ * @param owner the instance owner
+ * @param id the unique id of the record
+ * @throws StoreWriteException
+ */
+ void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException;
+
+ /**
+ * Removes all records from the store
+ *
+ * @throws StoreWriteException
+ */
+ void removeRecords() throws StoreWriteException;
+
+ /**
+ * Initiates a recovery operation, for example during restart after a crash
+ *
+ * @param listener the listener to receive recovery callback events
+ * @throws StoreReadException
+ */
+ void recover(RecoveryListener listener) throws StoreReadException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
new file mode 100644
index 0000000000..647eba33aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.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.store;
+
+
+/**
+ * Represents a generic exception thrown by a <code>Store</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreException extends Exception {
+ private static final long serialVersionUID = -319152147419962709L;
+
+ public StoreException() {
+ super();
+ }
+
+ public StoreException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreException(String message) {
+ super(message);
+ }
+
+ public StoreException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
new file mode 100644
index 0000000000..5c1a3ca79d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.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.store;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Fired when a store implementation expires a resource
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreExpirationEvent implements Event {
+ private Object source;
+ private RuntimeComponent owner;
+ private Object instance;
+
+ /**
+ * Constructor.
+ *
+ * @param source the source of the event
+ * @param owner the owner of the expiring object
+ * @param instance the expiring object
+ */
+ public StoreExpirationEvent(Object source, RuntimeComponent owner, Object instance) {
+ assert source != null;
+ assert owner != null;
+ assert instance != null;
+ this.source = source;
+ this.owner = owner;
+ this.instance = instance;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ /**
+ * Returns the owner of the expiring object.
+ *
+ * @return the owner of the expiring object.
+ */
+ public RuntimeComponent getOwner() {
+ return owner;
+ }
+
+ /**
+ * Returns the expiring object.
+ *
+ * @return the expiring object.
+ */
+ public Object getInstance() {
+ return instance;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
new file mode 100644
index 0000000000..66bbae684d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.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.store;
+
+
+/**
+ * A generic monintor interface for services to log events
+ *
+ * @version $Rev$ $Date$
+ */
+public interface StoreMonitor {
+
+ /**
+ * Signals the service has started
+ *
+ * @param msg
+ */
+ void start(String msg);
+
+ /**
+ * Signals the service has been shutdown
+ *
+ * @param msg
+ */
+ void stop(String msg);
+
+ /**
+ * Fired when recovery is started
+ */
+
+ void beginRecover();
+
+ /**
+ * Fired when recovery is completed
+ */
+
+ void endRecover();
+
+ /**
+ * Fired when a record is processed during recovery
+ *
+ * @param recordId the id of the record being recovered
+ */
+
+ void recover(Object recordId);
+
+ /**
+ * Signals an error event
+ *
+ * @param e the error
+ */
+
+ void error(Throwable e);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
new file mode 100644
index 0000000000..3a563b9fb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.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.store;
+
+/**
+ * Thrown when an error occurs reading from persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreReadException extends StoreException {
+ private static final long serialVersionUID = -8624542082121467271L;
+
+ public StoreReadException() {
+ super();
+ }
+
+ public StoreReadException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreReadException(String message) {
+ super(message);
+ }
+
+ public StoreReadException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
new file mode 100644
index 0000000000..ad55ce386b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.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.store;
+
+/**
+ * Thrown when an error occurs writing to persistent storage
+ *
+ * @version $Rev$ $Date$
+ */
+public class StoreWriteException extends StoreException {
+ private static final long serialVersionUID = 5539070473942048555L;
+
+ public StoreWriteException() {
+ super();
+ }
+
+ public StoreWriteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StoreWriteException(String message) {
+ super(message);
+ }
+
+ public StoreWriteException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
new file mode 100644
index 0000000000..5701a04ed1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.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.sca.work;
+
+/**
+ * A callback inyterface that can be optionally used for registering
+ * interest in status of asynchronously scheduled unit of work.
+ *
+ */
+public interface NotificationListener<T extends Runnable> {
+
+ /**
+ * Callback method when the unit of work is accepted.
+ *
+ * @param work Work that was accepted.
+ */
+ void workAccepted(T work);
+
+ /**
+ * Callback method when the unit of work is successfully completed.
+ *
+ * @param work Work that was succesfully completed.
+ */
+ void workCompleted(T work);
+
+ /**
+ * Callback when the unit of work is started.
+ *
+ * @param work Unit of work that was started.
+ */
+ void workStarted(T work);
+
+ /**
+ * Callback when the unit of work is rejected.
+ *
+ * @param work Unit of work that was rejected.
+ */
+ void workRejected(T work);
+
+ /**
+ * Callnack when the unit of work fails to complete.
+ *
+ * @param work Unit of work that failed to complete.
+ * @param error Error that caused the unit of work to fail.
+ */
+ void workFailed(T work, Throwable error);
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
new file mode 100644
index 0000000000..99cb601107
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.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.work;
+
+/**
+ * Defines the contract for scheduling asychronous units of work.
+ *
+ * <p>
+ * Units of work can be scheduled with an optional <code>NotificationListener</code>.
+ * If a notification listener is specified, the caller will be notified regarding the
+ * status of the work. The unit of work can either be completed, rejected or completed
+ * with an error. If the work completed with an error, the caller is notfied with the
+ * error details.
+ * </p>
+ *
+ */
+public interface WorkScheduler {
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ <T extends Runnable>void scheduleWork(T work, NotificationListener<T> listener);
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener
+ * is used to register interest in callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ <T extends Runnable>void scheduleWork(T work);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
new file mode 100644
index 0000000000..f3d32e376b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.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.work;
+
+
+/**
+ * Exception thrown by the work scheduler in case of unexpected exceptions.
+ *
+ * @version $Rev$ $Date$
+ *
+ */
+@SuppressWarnings("serial")
+public class WorkSchedulerException extends RuntimeException {
+
+ public WorkSchedulerException() {
+ super();
+ }
+
+ public WorkSchedulerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public WorkSchedulerException(String message) {
+ super(message);
+ }
+
+ public WorkSchedulerException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/test/resources/org/apache/tuscany/spi/util/stax/test.composite b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/test/resources/org/apache/tuscany/spi/util/stax/test.composite
new file mode 100644
index 0000000000..337ec02f06
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spi/src/test/resources/org/apache/tuscany/spi/util/stax/test.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.
+-->
+<!--
+ Test for stax.
+
+ $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="test.scdl">
+
+ <component name="test.component">
+ <system:implementation.system class="test.class"/>
+ <property name="testProperty">123</property>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/pom.xml
new file mode 100644
index 0000000000..f59ca7691c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core-spring</artifactId>
+ <name>Apache Tuscany SCA Spring-based Core Runtime</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>2.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>2.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>2.0.3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.java
new file mode 100644
index 0000000000..5b04d9e363
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanAssemblyFactory.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.sca.core.spring.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.AbstractProperty;
+import org.apache.tuscany.sca.assembly.AbstractReference;
+import org.apache.tuscany.sca.assembly.AbstractService;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeReference;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.Wire;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An alternate implementation of the SCA assembly model factory that creates SCA
+ * assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanAssemblyFactory implements AssemblyFactory {
+
+ private AssemblyFactory defaultFactory;
+ private BeanDefinitionRegistry beanRegistry;
+
+ public BeanAssemblyFactory(AssemblyFactory defaultFactory, BeanDefinitionRegistry beanRegistry) {
+ this.defaultFactory = defaultFactory;
+ this.beanRegistry = beanRegistry;
+ }
+
+ public BeanAssemblyFactory(BeanDefinitionRegistry beanRegistry) {
+ this(new DefaultAssemblyFactory(), beanRegistry);
+ }
+
+ public AbstractProperty createAbstractProperty() {
+ return defaultFactory.createAbstractProperty();
+ }
+
+ public AbstractReference createAbstractReference() {
+ return defaultFactory.createAbstractReference();
+ }
+
+ public AbstractService createAbstractService() {
+ return defaultFactory.createAbstractService();
+ }
+
+ public Callback createCallback() {
+ return defaultFactory.createCallback();
+ }
+
+ public Component createComponent() {
+ return new BeanComponentImpl(beanRegistry);
+ }
+
+ public ComponentProperty createComponentProperty() {
+ return defaultFactory.createComponentProperty();
+ }
+
+ public ComponentReference createComponentReference() {
+ return defaultFactory.createComponentReference();
+ }
+
+ public ComponentService createComponentService() {
+ return defaultFactory.createComponentService();
+ }
+
+ public ComponentType createComponentType() {
+ return defaultFactory.createComponentType();
+ }
+
+ public Composite createComposite() {
+ return defaultFactory.createComposite();
+ }
+
+ public CompositeReference createCompositeReference() {
+ return defaultFactory.createCompositeReference();
+ }
+
+ public CompositeService createCompositeService() {
+ return defaultFactory.createCompositeService();
+ }
+
+ public ConstrainingType createConstrainingType() {
+ return defaultFactory.createConstrainingType();
+ }
+
+ public Property createProperty() {
+ return defaultFactory.createProperty();
+ }
+
+ public Reference createReference() {
+ return defaultFactory.createReference();
+ }
+
+ public Service createService() {
+ return defaultFactory.createService();
+ }
+
+ public Wire createWire() {
+ return defaultFactory.createWire();
+ }
+
+ public Operation createOperation() {
+ return defaultFactory.createOperation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java
new file mode 100644
index 0000000000..85c5e7ec43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanComponentImpl.java
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.spring.assembly.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Visitor;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.ChildBeanDefinition;
+
+/**
+ * An implementation of the SCA assembly Component interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanComponentImpl extends ChildBeanDefinition implements Component, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private ConstrainingType constrainingType;
+ private Implementation implementation;
+ private String name;
+ private String uri;
+ private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved = false;
+ private BeanDefinitionRegistry beanRegistry;
+
+ protected BeanComponentImpl(BeanDefinitionRegistry beanRegistry) {
+ super((String)"");
+ this.beanRegistry = beanRegistry;
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ BeanComponentImpl clone = (BeanComponentImpl)super.clone();
+
+ clone.getProperties().clear();
+ for (ComponentProperty property: getProperties()) {
+ clone.getProperties().add((ComponentProperty)property.clone());
+ }
+ clone.getReferences().clear();
+ for (ComponentReference reference: getReferences()) {
+ clone.getReferences().add((ComponentReference)reference.clone());
+ }
+ clone.getServices().clear();
+ for (ComponentService service: getServices()) {
+ clone.getServices().add((ComponentService)service.clone());
+ }
+ return clone;
+ }
+
+ public String getParentName() {
+ //TODO find a better name for bean definitions representing component types
+ return String.valueOf(System.identityHashCode(implementation));
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public Implementation getImplementation() {
+ return implementation;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+
+ // Register this bean definition in the bean registry
+ this.beanRegistry.registerBeanDefinition(uri, this);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ //TODO use a better list implementation
+ private List<ComponentProperty> properties = new ArrayList<ComponentProperty>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a property
+ public boolean add(ComponentProperty property) {
+
+ // Add corresponding bean property value
+ getPropertyValues().addPropertyValue(property.getName(), property.getValue());
+
+ return super.add(property);
+ }
+ };
+
+ public List<ComponentProperty> getProperties() {
+ return properties;
+ }
+
+ //TODO use a better list implementation
+ private List<ComponentReference> references = new ArrayList<ComponentReference>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a reference
+ public boolean add(ComponentReference reference) {
+
+ // Add corresponding bean property value
+ if (!reference.getName().startsWith("$self$.")) {
+ BeanReferenceImpl beanReference = new BeanReferenceImpl(reference);
+ getPropertyValues().addPropertyValue(reference.getName(), beanReference);
+ }
+ return super.add(reference);
+ }
+ };
+
+ public List<ComponentReference> getReferences() {
+ return references;
+ }
+
+ public List<ComponentService> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public void setImplementation(Implementation implementation) {
+ this.implementation = implementation;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public boolean isAutowire() {
+ return super.getAutowireMode() == AUTOWIRE_BY_TYPE;
+ }
+
+ public void setAutowire(boolean autowire) {
+ super.setAutowireMode(autowire? AUTOWIRE_BY_TYPE:AUTOWIRE_NO);
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public boolean accept(Visitor visitor) {
+ if (!visitor.visit(this)) {
+ return false;
+ }
+ for (ComponentProperty property : properties) {
+ if (!visitor.visit(property)) {
+ return false;
+ }
+ }
+ for (ComponentReference reference : references) {
+ if (!visitor.visit(reference)) {
+ return false;
+ }
+ }
+ for (ComponentService service : services) {
+ if (!visitor.visit(service)) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.java
new file mode 100644
index 0000000000..bc139a3ef3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/assembly/impl/BeanReferenceImpl.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.sca.core.spring.assembly.impl;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
+
+/**
+ * An implementation of RuntimeBeanReference wrappering an SCA assembly Reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanReferenceImpl extends RuntimeBeanReference {
+ private Reference reference;
+
+ protected BeanReferenceImpl(Reference reference) {
+ super("temp");
+ this.reference = reference;
+ }
+
+ public String getBeanName() {
+ //TODO handle multiplicity
+ ComponentService componentService = reference.getTargets().get(0);
+ if (!componentService.isUnresolved()) {
+ SCABinding binding = componentService.getBinding(SCABinding.class);
+ return binding.getComponent().getURI();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean equals(Object other) {
+ if (this != other) {
+ if (other instanceof RuntimeBeanReference) {
+ RuntimeBeanReference br = (RuntimeBeanReference) other;
+ return (getBeanName().equals(br.getBeanName()) && this.isToParent() == br.isToParent());
+ } else
+ return false;
+ } else
+ return true;
+ }
+
+ public int hashCode() {
+ return getBeanName().hashCode() * 29 + (this.isToParent() ? 1 : 0);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.java
new file mode 100644
index 0000000000..ba2d5045f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ModelResolverImpl.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.core.spring.context;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ModelResolverImpl implements ModelResolver {
+ private static final long serialVersionUID = -7826976465762296634L;
+
+ private Map<Object, Object> map = new HashMap<Object, Object>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public ModelResolverImpl(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ 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 if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
new file mode 100644
index 0000000000..24bc719e6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.spring.context;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.core.spring.assembly.impl.BeanAssemblyFactory;
+import org.apache.tuscany.sca.core.spring.implementation.java.impl.BeanJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+
+/**
+ * A mini test runtime that uses the SCA assembly model variant implementation
+ * backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCADomainContext {
+
+ private DefaultListableBeanFactory beanFactory;
+
+ public SCADomainContext(String... compositeFiles) {
+
+ // Create Spring bean factory
+ beanFactory = new DefaultListableBeanFactory();
+
+ // Create SCA assembly and SCA Java factories
+ AssemblyFactory assemblyFactory = new BeanAssemblyFactory(new DefaultAssemblyFactory(), beanFactory);
+ SCABindingFactory scaBindingFactory = new DefaultSCABindingFactory();
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ InterfaceContractMapper interfaceContractMapper = new InterfaceContractMapperImpl();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint interfaceVisitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ JavaImplementationFactory javaImplementationFactory = new BeanJavaImplementationFactory(beanFactory);
+ JavaClassIntrospectorExtensionPoint classVisitors = new DefaultJavaClassIntrospectorExtensionPoint();
+
+ JavaInterfaceIntrospector interfaceIntrospector = new ExtensibleJavaInterfaceIntrospector(javaFactory, interfaceVisitors);
+
+ BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
+ new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory),
+ new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory),
+ new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new ResourceProcessor(assemblyFactory),
+ new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new PolicyProcessor(assemblyFactory, policyFactory)
+ };
+ for (JavaClassVisitor e : extensions) {
+ classVisitors.addClassVisitor(e);
+ }
+ JavaClassIntrospector classIntrospector = new ExtensibleJavaClassIntrospector(classVisitors);
+
+ // Populate ArtifactProcessor registry
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory,
+ interfaceContractMapper, staxProcessor);
+ staxProcessors.addArtifactProcessor(compositeProcessor);
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new JavaInterfaceProcessor(javaFactory, interfaceIntrospector));
+ staxProcessors.addArtifactProcessor(new JavaImplementationProcessor(assemblyFactory, policyFactory, javaImplementationFactory, classIntrospector));
+
+ // Create a resolver
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ ModelResolverImpl resolver = new ModelResolverImpl(classLoader);
+
+ try {
+
+ // Read the composite files
+ List<Composite> composites = new ArrayList<Composite>();
+ for (String compositeFile: compositeFiles) {
+ InputStream is = classLoader.getResourceAsStream(compositeFile);
+ Composite composite = staxProcessor.read(is, Composite.class);
+ resolver.addModel(composite);
+ composites.add(composite);
+ }
+
+ for (Composite composite: composites) {
+
+ // Resolve the composite
+ compositeProcessor.resolve(composite, resolver);
+ }
+
+ // Wire the top level component's composite
+ buildComposite(composites.get(0), assemblyFactory, scaBindingFactory, interfaceContractMapper);
+
+ } catch (ContributionException e) {
+ throw new RuntimeException(e);
+ } catch (CompositeBuilderException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private void buildComposite(Composite composite, AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory, InterfaceContractMapper interfaceContractMapper) throws CompositeBuilderException {
+
+ CompositeBuilderMonitor monitor = new CompositeBuilderMonitor() {
+
+ public void problem(Problem problem) {
+ // Uncommenting the following two lines can be useful to detect
+ // and troubleshoot SCA assembly XML composite configuration
+ // problems.
+
+ System.out.println("Composite assembly problem: " + problem.getMessage());
+ }
+ };
+
+ // Configure and wire the composite
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, monitor);
+ compositeUtil.build(composite);
+
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ Object bean = beanFactory.getBean(serviceName);
+ return businessInterface.cast(bean);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java
new file mode 100644
index 0000000000..8a88ba28d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanBaseJavaImplementationImpl.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+
+/**
+ * An implementation of the SCA assembly JavaImplementation interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanBaseJavaImplementationImpl extends RootBeanDefinition implements BaseJavaImplementation, Cloneable {
+ private static final long serialVersionUID = 1L;
+
+ private List<Service> services = new ArrayList<Service>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private ConstrainingType constrainingType;
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
+ private BeanDefinitionRegistry beanRegistry;
+ private String uri;
+
+ protected BeanBaseJavaImplementationImpl(BeanDefinitionRegistry beanRegistry) {
+ this.beanRegistry = beanRegistry;
+
+ // Register this bean definition in the bean registry
+ //TODO find a better name for bean definitions representing component types
+ String name = String.valueOf(System.identityHashCode(this));
+ this.beanRegistry.registerBeanDefinition(name, this);
+ }
+
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ BeanBaseJavaImplementationImpl clone = (BeanBaseJavaImplementationImpl)super.clone();
+
+ clone.getServices().clear();
+ for (Service service: getServices()) {
+ clone.getServices().add((Service)service.clone());
+ }
+ clone.getReferences().clear();
+ for (Reference reference: getReferences()) {
+ clone.getReferences().add((Reference)reference.clone());
+ }
+ clone.getProperties().clear();
+ for (Property property: getProperties()) {
+ clone.getProperties().add((Property)property.clone());
+ }
+ return clone;
+ }
+
+ public Class<?> getJavaClass() {
+ return super.getBeanClass();
+ }
+
+ public String getName() {
+ return super.getBeanClassName();
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ super.setBeanClass(javaClass);
+ }
+
+ public void setName(String className) {
+ super.setBeanClassName(className);
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ //TODO use a better list implementation
+ private List<Property> properties = new ArrayList<Property>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a property
+ public boolean add(Property property) {
+
+ // Add corresponding bean property value
+ getPropertyValues().addPropertyValue(property.getName(), property.getValue());
+
+ return super.add(property);
+ }
+ };
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ //TODO use a better list implementation
+ private List<Reference> references = new ArrayList<Reference>() {
+ private static final long serialVersionUID = 1L;
+
+ // Add a reference
+ public boolean add(Reference reference) {
+
+ // Add corresponding bean property value
+ String target;
+ if (!reference.getTargets().isEmpty()) {
+ //TODO handle multiplicity
+ target = reference.getTargets().get(0).getName();
+ int i = target.indexOf('/');
+ if (i != -1)
+ target = target.substring(0, i);
+ } else {
+ target = null;
+ }
+ getPropertyValues().addPropertyValue(reference.getName(), target);
+
+ return super.add(reference);
+ }
+ };
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.java
new file mode 100644
index 0000000000..c9cd0f8892
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationFactory.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.core.spring.implementation.java.impl;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An alternate implementation of the SCA Java assembly model factory that creates SCA
+ * Java assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaImplementationFactory implements JavaImplementationFactory {
+
+ private BeanDefinitionRegistry beanRegistry;
+
+ public BeanJavaImplementationFactory(BeanDefinitionRegistry beanRegistry) {
+ this.beanRegistry = beanRegistry;
+ }
+
+ public JavaImplementation createJavaImplementation() {
+ return new BeanJavaImplementationImpl(beanRegistry);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java
new file mode 100644
index 0000000000..5d787d2fd2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaImplementationImpl.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.spring.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.springframework.beans.factory.support.BeanDefinitionRegistry;
+
+/**
+ * An implementation of the SCA assembly JavaImplementation interface backed by a Spring
+ * Bean definition.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class BeanJavaImplementationImpl extends BeanBaseJavaImplementationImpl implements JavaImplementation {
+ private static final long serialVersionUID = 6792198458193774178L;
+
+ private JavaConstructorImpl<?> constructorDefinition;
+ private Map<Constructor, JavaConstructorImpl> constructors = new HashMap<Constructor, JavaConstructorImpl>();
+ private Method initMethod;
+ private Method destroyMethod;
+ private final Map<String, JavaResourceImpl> resources = new HashMap<String, JavaResourceImpl>();
+ private final Map<String, JavaElementImpl> propertyMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> referenceMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> callbackMembers = new HashMap<String, JavaElementImpl>();
+ private Member conversationIDMember;
+ private boolean eagerInit;
+ private boolean allowsPassByReference;
+ private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
+ private long maxAge = -1;
+ private long maxIdleTime = -1;
+ private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+
+ protected BeanJavaImplementationImpl(BeanDefinitionRegistry beanRegistry) {
+ super(beanRegistry);
+ }
+
+ public JavaConstructorImpl<?> getConstructor() {
+ return constructorDefinition;
+ }
+
+ public void setConstructor(JavaConstructorImpl<?> definition) {
+ this.constructorDefinition = definition;
+ }
+
+ public Method getInitMethod() {
+ return initMethod;
+ }
+
+ public void setInitMethod(Method initMethod) {
+ this.initMethod = initMethod;
+ }
+
+ public Method getDestroyMethod() {
+ return destroyMethod;
+ }
+
+ public void setDestroyMethod(Method destroyMethod) {
+ this.destroyMethod = destroyMethod;
+ }
+
+ public Map<String, JavaResourceImpl> getResources() {
+ return resources;
+ }
+
+ public Member getConversationIDMember() {
+ return this.conversationIDMember;
+ }
+
+ public void setConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember = conversationIDMember;
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+ public List<Method> getAllowsPassByReferenceMethods() {
+ return allowsPassByReferenceMethods;
+ }
+
+ public boolean isAllowsPassByReference(Method method) {
+ return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
+ }
+
+ public Map<Constructor, JavaConstructorImpl> getConstructors() {
+ return constructors;
+ }
+
+ public boolean isEagerInit() {
+ return eagerInit;
+ }
+
+ public void setEagerInit(boolean eagerInit) {
+ this.eagerInit = eagerInit;
+ }
+
+ public Map<String, JavaElementImpl> getCallbackMembers() {
+ return callbackMembers;
+ }
+
+ public Map<String, JavaElementImpl> getPropertyMembers() {
+ return propertyMembers;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceMembers() {
+ return referenceMembers;
+ }
+
+ public JavaScopeImpl getJavaScope() {
+ return scope;
+ }
+
+ public void setJavaScope(JavaScopeImpl scope) {
+ this.scope = scope;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.java
new file mode 100644
index 0000000000..17a7e9084c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceContractImpl.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.core.spring.implementation.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceContractImpl;
+
+/**
+ * An implementation of a Java interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceContractImpl extends JavaInterfaceContractImpl {
+
+ protected BeanJavaInterfaceContractImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.java
new file mode 100644
index 0000000000..6557d23f27
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceFactory.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.sca.core.spring.implementation.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * An alternate implementation of the SCA Java assembly model factory that creates SCA
+ * Java assembly model objects backed by Spring bean definitions.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceFactory implements JavaInterfaceFactory {
+
+ public BeanJavaInterfaceFactory() {
+ }
+
+ public JavaInterface createJavaInterface() {
+ return new BeanJavaInterfaceImpl();
+ }
+
+ public JavaInterfaceContract createJavaInterfaceContract() {
+ return new BeanJavaInterfaceContractImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.java
new file mode 100644
index 0000000000..3d2c4b3e4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/implementation/java/impl/BeanJavaInterfaceImpl.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.sca.core.spring.implementation.java.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * An alternate implementation of the SCA Java assembly model JavaInterface
+ * interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class BeanJavaInterfaceImpl implements JavaInterface {
+
+ private String className;
+ private Class<?> javaClass;
+ private Class<?> callbackClass;
+ private boolean conversational;
+ private boolean remotable;
+ List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Operation> operations = new ArrayList<Operation>();
+ private boolean unresolved = false;
+
+ protected BeanJavaInterfaceImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ }
+ else {
+ return javaClass.getName();
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved())
+ throw new IllegalStateException();
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public Class<?> getCallbackClass() {
+ return callbackClass;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ this.callbackClass = callbackClass;
+ }
+
+ public boolean isConversational() {
+ return conversational;
+ }
+
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ public void setConversational(boolean conversational) {
+ this.conversational = conversational;
+ }
+
+ public void setRemotable(boolean local) {
+ this.remotable = local;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public void setDefaultDataBinding(String dataBinding) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..ea3e5341d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/AddServiceImpl.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;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..56e737e3ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * Calculator service and invoke it.
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomainContext context = new SCADomainContext("org/apache/tuscany/core/spring/Calculator.composite");
+
+ CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorService.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 calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..11e8974657
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Scope("COMPOSITE")
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..9c7e96a668
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/DivideServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("COMPOSITE")
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..4892481203
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/MultiplyServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ */
+@Scope("COMPOSITE")
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.java
new file mode 100644
index 0000000000..27430b7f5d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/NestedCalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the
+ * Calculator service and invoke it.
+ */
+public class NestedCalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomainContext context = new SCADomainContext(
+ "org/apache/tuscany/core/spring/OuterCalculator.composite",
+ "org/apache/tuscany/core/spring/InnerCalculator.composite",
+ "org/apache/tuscany/core/spring/InnerOperations.composite");
+
+ CalculatorService calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..ee1d7c3457
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/calculator/SubtractServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Scope("COMPOSITE")
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.java
new file mode 100644
index 0000000000..97a44258a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/CalculatorTestCase.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.core.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private SCADomainContext context;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ context = new SCADomainContext("org/apache/tuscany/sca/core/spring/Calculator.composite");
+
+ calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ context = null;
+ calculatorService = null;
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCase.java
new file mode 100644
index 0000000000..5ef16a91d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/java/org/apache/tuscany/sca/core/spring/NestedCalculatorTestCase.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.core.spring;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.spring.context.SCADomainContext;
+
+import calculator.CalculatorService;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class NestedCalculatorTestCase extends TestCase {
+
+ private SCADomainContext context;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ context = new SCADomainContext(
+ "org/apache/tuscany/sca/core/spring/OuterCalculator.composite",
+ "org/apache/tuscany/sca/core/spring/InnerCalculator.composite",
+ "org/apache/tuscany/sca/core/spring/InnerOperations.composite");
+
+ calculatorService = context.getService(CalculatorService.class, "CalculatorServiceComponent/InnerCalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ context = null;
+ calculatorService = null;
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.composite
new file mode 100644
index 0000000000..6d998ba035
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/Calculator.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:calc="http://sample.calculator"
+ name="calc:TestBeanCalculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite
new file mode 100644
index 0000000000..8b043f2b4f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerCalculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="InnerCalculator">
+
+ <service name="CalculatorService" promote="InnerCalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="InnerCalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService"/>
+ <reference name="subtractService"/>
+ <reference name="multiplyService"/>
+ <reference name="divideService"/>
+ </component>
+
+ <reference name="addService" promote="InnerCalculatorServiceComponent/addService"/>
+ <reference name="subtractService" promote="InnerCalculatorServiceComponent/subtractService"/>
+ <reference name="multiplyService" promote="InnerCalculatorServiceComponent/multiplyService"/>
+ <reference name="divideService" promote="InnerCalculatorServiceComponent/divideService"/>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite
new file mode 100644
index 0000000000..d7d1124050
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/InnerOperations.composite
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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:calc="http://calc"
+ targetNamespace="http://calc"
+ name="InnerOperations">
+
+ <service name="AddService" promote="AddServiceComponent">
+ <interface.java interface="calculator.AddService"/>
+ </service>
+
+ <service name="SubtractService" promote="SubtractServiceComponent">
+ <interface.java interface="calculator.SubtractService"/>
+ </service>
+
+ <service name="MultiplyService" promote="MultiplyServiceComponent">
+ <interface.java interface="calculator.MultiplyService"/>
+ </service>
+
+ <service name="DivideService" promote="DivideServiceComponent">
+ <interface.java interface="calculator.DivideService"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite
new file mode 100644
index 0000000000..c2b6cced36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core-spring/src/test/resources/org/apache/tuscany/sca/core/spring/OuterCalculator.composite
@@ -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"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="OuterCalculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.composite name="calc:InnerCalculator"/>
+ <reference name="addService" target="OperationsServiceComponent/AddService"/>
+ <reference name="subtractService" target="OperationsServiceComponent/SubtractService"/>
+ <reference name="multiplyService" target="OperationsServiceComponent/MultiplyService"/>
+ <reference name="divideService" target="OperationsServiceComponent/DivideService"/>
+ </component>
+
+ <component name="OperationsServiceComponent">
+ <implementation.composite name="calc:InnerOperations"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/core/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/core/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/core/.pmd
new file mode 100644
index 0000000000..ffc4fe2bbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/></pmd>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/core/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/.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/sca-java-1.x/branches/sca-java-0.90/modules/core/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/core/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/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/sca-java-1.x/branches/sca-java-0.90/modules/core/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/core/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/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/sca-java-1.x/branches/sca-java-0.90/modules/core/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/core/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/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/sca-java-1.x/branches/sca-java-0.90/modules/core/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/core/pom.xml
new file mode 100644
index 0000000000..0db49e7726
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/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.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-core</artifactId>
+ <name>Apache Tuscany SCA Core Runtime</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>commonj-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallableReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallableReferenceImpl.java
new file mode 100644
index 0000000000..f0f0049056
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallableReferenceImpl.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 org.apache.tuscany.sca.core.component;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.Conversation;
+
+/**
+ * Base class for implementations of service and callback references.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the type of the business interface
+ */
+public abstract class CallableReferenceImpl<B> implements CallableReference<B> {
+ private final Class<B> businessInterface;
+ private final ObjectFactory<B> factory;
+
+ protected CallableReferenceImpl(Class<B> businessInterface, ObjectFactory<B> factory) {
+ this.businessInterface = businessInterface;
+ this.factory = factory;
+ }
+
+ public B getService() {
+ return factory.getInstance();
+ }
+
+ public Class<B> getBusinessInterface() {
+ return businessInterface;
+ }
+
+ public boolean isConversational() {
+ return false;
+ }
+
+ public Conversation getConversation() {
+ return null;
+ }
+
+ public Object getCallbackID() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallbackReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallbackReferenceImpl.java
new file mode 100644
index 0000000000..45a48730d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/CallbackReferenceImpl.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.core.component;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Default implementation of a callback reference.
+ *
+ * @version $Rev$ $Date$
+ * @param <CB> the type of the business interface
+ */
+public class CallbackReferenceImpl<CB> extends CallableReferenceImpl<CB> {
+ public CallbackReferenceImpl(Class<CB> businessInterface, ObjectFactory<CB> factory) {
+ super(businessInterface, factory);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextImpl.java
new file mode 100644
index 0000000000..abcd17f505
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextImpl.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.core.component;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Implementation of ComponentContext that delegates to a ComponentContextProvider.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentContextImpl implements ComponentContext {
+ private final ComponentContextProvider component;
+
+ public ComponentContextImpl(ComponentContextProvider component) {
+ this.component = component;
+ }
+
+ public String getURI() {
+ try {
+ return component.getUri().toString();
+ } catch (RuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ try {
+ return (R) component.cast(target);
+ } catch (RuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ try {
+ return component.getService(businessInterface, referenceName);
+ } catch (RuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ try {
+ return component.getServiceReference(businessInterface, referenceName);
+ } catch (RuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ try {
+ return component.getProperty(type, propertyName);
+ } catch (RuntimeException e) {
+ throw new ServiceRuntimeException(e.getMessage(), e);
+ }
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ return getServiceReference(businessInterface, "$self$.");
+ // FIXME: How to get the ObjectFactory?
+ // ObjectFactory<B> factory = ((AtomicComponent) component).createObjectFactory();
+ // return new ServiceReferenceImpl<B>(businessInterface, factory);
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
+ return getServiceReference(businessInterface, "$self$."+serviceName);
+ }
+
+ public RequestContext getRequestContext() {
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextProvider.java
new file mode 100644
index 0000000000..3999d0d5b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ComponentContextProvider.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.sca.core.component;
+
+import java.net.URI;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Interface implemented by Component's that want to expose a ComponentContext.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContextProvider {
+ ComponentContext getComponentContext();
+
+ URI getUri();
+
+ <B> B getService(Class<B> businessInterface, String referenceName);
+
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ <B> B getProperty(Class<B> type, String propertyName);
+
+ <B, R extends CallableReference<B>> R cast(B target);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/RequestContextImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/RequestContextImpl.java
new file mode 100644
index 0000000000..3a219b9cd9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/RequestContextImpl.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.core.component;
+
+import javax.security.auth.Subject;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextImpl implements RequestContext {
+
+ public RequestContextImpl() {
+ }
+
+ public Subject getSecuritySubject() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getServiceName() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <B> ServiceReference<B> getServiceReference() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CB getCallback() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CallableReference<CB> getCallbackReference() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ServiceReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ServiceReferenceImpl.java
new file mode 100644
index 0000000000..e268f5750f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/component/ServiceReferenceImpl.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.core.component;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Default implementation of a ServiceReference.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the type of the business interface
+ */
+public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B> {
+ public ServiceReferenceImpl(Class<B> businessInterface, ObjectFactory<B> factory) {
+ super(businessInterface, factory);
+ }
+
+ public Object getConversationID() {
+ return null;
+ }
+
+ public void setConversationID(Object conversationId) throws IllegalStateException {
+ }
+
+ public void setCallbackID(Object callbackID) {
+ }
+
+ public Object getCallback() {
+ return null;
+ }
+
+ public void setCallback(Object callback) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
new file mode 100644
index 0000000000..517e5579a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.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.core.event;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.event.EventFilter;
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.event.TrueFilter;
+
+/**
+ * Base implementation of an <code>EventPublisher</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseEventPublisher implements EventPublisher {
+ protected static final EventFilter TRUE_FILTER = new TrueFilter();
+ protected Map<EventFilter, List<RuntimeEventListener>> listeners;
+
+ public void addListener(RuntimeEventListener listener) {
+ addListener(TRUE_FILTER, listener);
+ }
+
+ public void removeListener(RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ for (List<RuntimeEventListener> currentList : getListeners().values()) {
+ for (RuntimeEventListener current : currentList) {
+ if (current == listener) {
+ currentList.remove(current);
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ public void addListener(EventFilter filter, RuntimeEventListener listener) {
+ assert listener != null : "Listener cannot be null";
+ synchronized (getListeners()) {
+ List<RuntimeEventListener> list = getListeners().get(filter);
+ if (list == null) {
+ list = new CopyOnWriteArrayList<RuntimeEventListener>();
+ listeners.put(filter, list);
+ }
+ list.add(listener);
+ }
+ }
+
+ public void publish(Event event) {
+ assert event != null : "Event object was null";
+ for (Map.Entry<EventFilter, List<RuntimeEventListener>> entry : getListeners().entrySet()) {
+ if (entry.getKey().match(event)) {
+ for (RuntimeEventListener listener : entry.getValue()) {
+ listener.onEvent(event);
+ }
+ }
+ }
+ }
+
+ protected Map<EventFilter, List<RuntimeEventListener>> getListeners() {
+ if (listeners == null) {
+ listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
+ }
+ return listeners;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
new file mode 100644
index 0000000000..8e90c953e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.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.core.event;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a component starts
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ComponentStart implements Event {
+
+ private Object source;
+ private URI uri;
+
+ /**
+ * Creates a component start event
+ *
+ * @param source the source of the event
+ * @param componentURI the uri of the component being started
+ */
+ public ComponentStart(Object source, URI componentURI) {
+ this.source = source;
+ this.uri = componentURI;
+ }
+
+ public URI getComponentURI() {
+ return uri;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
new file mode 100644
index 0000000000..d879182e14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.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.sca.core.event;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a component stops
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ComponentStop implements Event {
+
+ private Object source;
+ private URI uri;
+
+ /**
+ * Creates a component stop event
+ *
+ * @param source the source of the event
+ * @param componentUri the composite component associated the component being stopped
+ */
+ public ComponentStop(Object source, URI componentUri) {
+ this.source = source;
+ this.uri = componentUri;
+ }
+
+ public URI getComponentURI() {
+ return uri;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
new file mode 100644
index 0000000000..cd14710880
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.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.sca.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+
+/**
+ * Propagated when a conversation is expired
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ConversationEnd implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the conversation being ended
+ */
+ public ConversationEnd(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getConversationID() {
+ return id;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
new file mode 100644
index 0000000000..a4cc49204e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+/**
+ * Propagated when a conversation has started
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ConversationStart implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the conversation being started
+ */
+ public ConversationStart(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getConversationID() {
+ return id;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
new file mode 100644
index 0000000000..4c3fd8b397
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.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.sca.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+
+/**
+ * Propagated when an HTTP-based session is expired
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class HttpSessionEnd implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the HTTP session being ended
+ */
+ public HttpSessionEnd(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getSessionID() {
+ return id;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
new file mode 100644
index 0000000000..67b922b99c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+
+/**
+ * Propagated when an HTTP-based session has started
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class HttpSessionStart implements Event {
+
+ private Object source;
+ private Object id;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ * @param id the id of the HTTP session being started
+ */
+ public HttpSessionStart(Object source, Object id) {
+ this.source = source;
+ this.id = id;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+ public Object getSessionID() {
+ return id;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
new file mode 100644
index 0000000000..8b5c512cf2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a request completes or is ended
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RequestEnd implements Event {
+
+ private Object source;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ */
+ public RequestEnd(Object source) {
+ this.source = source;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
new file mode 100644
index 0000000000..974563b57c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.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.core.event;
+
+import org.apache.tuscany.sca.event.Event;
+
+/**
+ * Propagated when a request is started in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class RequestStart implements Event {
+
+ private Object source;
+
+ /**
+ * Creates a new event
+ *
+ * @param source the source of the event
+ */
+ public RequestStart(Object source) {
+ this.source = source;
+ }
+
+ public Object getSource() {
+ return source;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AbstractInvocationHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AbstractInvocationHandler.java
new file mode 100644
index 0000000000..6c1f38e4c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/AbstractInvocationHandler.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.sca.core.invocation;
+
+import java.util.UUID;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Base class for performing invocations on a wire. Subclasses are responsible for retrieving and supplying the
+ * appropriate chain, target invoker, and invocation arguments.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractInvocationHandler {
+ protected boolean conversational;
+ private boolean conversationStarted;
+ private MessageFactory messageFactory;
+
+ protected AbstractInvocationHandler(MessageFactory messageFactory, boolean conversational) {
+ this.conversational = conversational;
+ this.messageFactory = messageFactory;
+ }
+
+ protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire) throws Throwable {
+
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ Message msg = messageFactory.createMessage();
+ if (conversational) {
+ Object id = msgContext.getConversationID();
+ if (id == null) {
+ String convIdFromThread = createConversationID();
+ msg.setConversationID(convIdFromThread);
+ }
+ }
+
+ Invoker headInvoker = chain.getHeadInvoker();
+ msg.setCorrelationID(msgContext.getCorrelationID());
+ Operation operation = chain.getTargetOperation();
+ Interface contract = operation.getInterface();
+ if (contract != null && contract.isConversational()) {
+ ConversationSequence sequence = chain.getTargetOperation().getConversationSequence();
+ if (sequence == ConversationSequence.CONVERSATION_END) {
+ msg.setConversationSequence(ConversationSequence.CONVERSATION_END);
+ conversationStarted = false;
+ } else if (sequence == ConversationSequence.CONVERSATION_CONTINUE) {
+ if (conversationStarted) {
+ msg.setConversationSequence(ConversationSequence.CONVERSATION_CONTINUE);
+ } else {
+ conversationStarted = true;
+ msg.setConversationSequence(ConversationSequence.CONVERSATION_START);
+ }
+ }
+ }
+ msg.setBody(args);
+ msg.setFrom(wire.getSource());
+ msg.setTo(wire.getTarget());
+ ThreadMessageContext.setMessageContext(msg);
+ try {
+ // dispatch the wire down the chain and get the response
+ Message resp = headInvoker.invoke(msg);
+ Object body = resp.getBody();
+ if (resp.isFault()) {
+ throw (Throwable)body;
+ }
+ return body;
+ } finally {
+ ThreadMessageContext.setMessageContext(msgContext);
+ }
+ }
+
+ /**
+ * Creates a new conversational id
+ *
+ * @return the conversational id
+ */
+ private String createConversationID() {
+ return UUID.randomUUID().toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
new file mode 100644
index 0000000000..219dc55536
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.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.core.invocation;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.NoRegisteredCallbackException;
+
+/**
+ * An interceptor applied to the forward direction of a wire that ensures the callback target implements the required
+ * service contract. This is required as callback targets may be set dynamically by service implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackInterfaceInterceptor implements Interceptor {
+ private boolean invokingServiceImplements;
+ private Invoker next;
+
+ public CallbackInterfaceInterceptor(boolean invokingServiceImplements) {
+ this.invokingServiceImplements = invokingServiceImplements;
+ }
+
+ public Message invoke(Message msg) {
+ // TODO check in the context if a callback object is set, if so invoke next since the setCallback will
+ // perform the check
+ if (!invokingServiceImplements) {
+ throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
+ }
+ return next.invoke(msg);
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
new file mode 100644
index 0000000000..dae4ed708b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.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.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Returns proxy instance for a wire callback
+ *
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactory implements ObjectFactory {
+ private ProxyFactory proxyFactory;
+ private Class<?> interfaze;
+ private List<RuntimeWire> wires;
+
+ public CallbackWireObjectFactory(Class<?> interfaze, ProxyFactory proxyService, List<RuntimeWire> wires) {
+ this.interfaze = interfaze;
+ this.proxyFactory = proxyService;
+ this.wires = wires;
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ return proxyFactory.createCallbackProxy(interfaze, wires);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java
new file mode 100644
index 0000000000..934f2f7aa0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.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.sca.core.invocation;
+
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+
+/**
+ * The default implementation of an extensible <code>WireProcessor</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleWireProcessor implements RuntimeWireProcessor {
+
+ private RuntimeWireProcessorExtensionPoint processors;
+
+ public ExtensibleWireProcessor(RuntimeWireProcessorExtensionPoint processors) {
+ this.processors = processors;
+ }
+
+ public void process(RuntimeWire wire) {
+ for (RuntimeWireProcessor processor : processors.getWireProcessors()) {
+ processor.process(wire);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
new file mode 100644
index 0000000000..e04148e374
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.invocation;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+
+/**
+ * Default implementation of an invocation chain
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImpl implements InvocationChain {
+ private Operation sourceOperation;
+ private Operation targetOperation;
+ private Invoker invokerChainHead;
+ private Invoker invokerChainTail;
+
+ public InvocationChainImpl(Operation operation) {
+ assert operation != null;
+ this.targetOperation = operation;
+ this.sourceOperation = operation;
+ }
+
+ public InvocationChainImpl(Operation sourceOperation, Operation targetOperation) {
+ assert sourceOperation != null;
+ assert targetOperation != null;
+ this.targetOperation = targetOperation;
+ this.sourceOperation = sourceOperation;
+ }
+
+ public Operation getTargetOperation() {
+ return targetOperation;
+ }
+
+ public void addInterceptor(Interceptor interceptor) {
+ if (invokerChainHead == null) {
+ invokerChainHead = interceptor;
+ } else {
+ if (invokerChainHead instanceof Interceptor) {
+ ((Interceptor)invokerChainTail).setNext(interceptor);
+ }
+ }
+ invokerChainTail = interceptor;
+ }
+
+ public void addInvoker(Invoker invoker) {
+ if (invokerChainHead == null) {
+ invokerChainHead = invoker;
+ } else {
+ if (invokerChainTail instanceof Interceptor) {
+ ((Interceptor)invokerChainTail).setNext(invoker);
+ }
+ }
+ invokerChainTail = invoker;
+ }
+
+ public Invoker getHeadInvoker() {
+ return invokerChainHead;
+ }
+
+ public Invoker getTailInvoker() {
+ return invokerChainTail;
+ }
+
+ /**
+ * @return the sourceOperation
+ */
+ public Operation getSourceOperation() {
+ return sourceOperation;
+ }
+
+ /**
+ * @param sourceOperation the sourceOperation to set
+ */
+ public void setSourceOperation(Operation sourceOperation) {
+ this.sourceOperation = sourceOperation;
+ }
+
+ public void addInterceptor(int index, Interceptor interceptor) {
+ int i = 0;
+ Invoker next = invokerChainHead;
+ Invoker prev = null;
+ while (next != null && i < index) {
+ prev = next;
+ if (next instanceof Interceptor) {
+ next = ((Interceptor)next).getNext();
+ i++;
+ } else {
+ throw new ArrayIndexOutOfBoundsException(index);
+ }
+ }
+ if (i == index) {
+ if (prev != null) {
+ ((Interceptor)prev).setNext(interceptor);
+ } else {
+ invokerChainHead = interceptor;
+ }
+ interceptor.setNext(next);
+ if (next == null) {
+ invokerChainTail = interceptor;
+ }
+ } else {
+ throw new ArrayIndexOutOfBoundsException(index);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
new file mode 100644
index 0000000000..5a028e6e22
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.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.core.invocation;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.NoRegisteredCallbackException;
+
+/**
+ * Responsible for dispatching to a callback through a wire. <p/> TODO cache
+ * target invoker
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDKCallbackInvocationHandler extends AbstractInvocationHandler implements InvocationHandler {
+ private static final long serialVersionUID = -3350283555825935609L;
+ private transient Map<String, RuntimeWire> wires;
+
+ /**
+ * Constructor used for deserialization only
+ */
+ public JDKCallbackInvocationHandler(MessageFactory messageFactory) {
+ super(messageFactory, false);
+ wires = new HashMap<String, RuntimeWire>();
+ }
+
+ public JDKCallbackInvocationHandler(MessageFactory messageFactory, List<RuntimeWire> wireList) {
+ super(messageFactory, false);
+ this.wires = new HashMap<String, RuntimeWire>();
+ for (RuntimeWire wire : wireList) {
+ wires.put(wire.getSource().getURI(), wire);
+ }
+ }
+
+ @SuppressWarnings( {"unchecked"})
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getParameterTypes().length == 0 && "toString".equals(method.getName())) {
+ return "[Proxy - " + Integer.toHexString(hashCode()) + "]";
+ } else if (method.getDeclaringClass().equals(Object.class) && "equals".equals(method.getName())) {
+ // TODO implement
+ throw new UnsupportedOperationException();
+ } else if (Object.class.equals(method.getDeclaringClass()) && "hashCode".equals(method.getName())) {
+ return hashCode();
+ // TODO beter hash algorithm
+ }
+ EndpointReference from = ThreadMessageContext.getMessageContext().getFrom();
+ RuntimeWire wire = wires.get(from.getURI());
+ assert wire != null;
+ List<InvocationChain> chains = wire.getCallbackInvocationChains();
+ IdentityHashMap<Operation, InvocationChain> map = new IdentityHashMap<Operation, InvocationChain>();
+ for (InvocationChain chain : chains) {
+ map.put(chain.getTargetOperation(), chain);
+ }
+ Operation operation = JavaInterfaceUtil.findOperation(method, map.keySet());
+ InvocationChain chain = map.get(operation);
+ try {
+ return invoke(chain, args, wire);
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getCause();
+ if (t instanceof NoRegisteredCallbackException) {
+ throw t;
+ }
+ throw e;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
new file mode 100644
index 0000000000..c22481cb73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.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.core.invocation;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKInvocationHandler extends AbstractInvocationHandler implements InvocationHandler {
+ // private Class<?> proxyInterface;
+ private RuntimeWire wire;
+
+ public JDKInvocationHandler(MessageFactory messageFactory, Class<?> proxyInterface, RuntimeWire wire) {
+ super(messageFactory, false);
+ this.wire = wire;
+ init(proxyInterface, wire);
+ }
+
+ private void init(Class<?> interfaze, RuntimeWire wire) {
+ InterfaceContract contract = wire.getSource().getInterfaceContract();
+ this.conversational = contract.getInterface().isConversational();
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getParameterTypes().length == 0 && "toString".equals(method.getName())) {
+ return "[Proxy - " + Integer.toHexString(hashCode()) + "]";
+ } else if (method.getDeclaringClass().equals(Object.class) && "equals".equals(method.getName())) {
+ Object obj = args[0];
+ if (obj == null) {
+ return false;
+ }
+ if (!Proxy.isProxyClass(obj.getClass())) {
+ return false;
+ }
+ return equals(Proxy.getInvocationHandler(obj));
+ } else if (Object.class.equals(method.getDeclaringClass()) && "hashCode".equals(method.getName())) {
+ return hashCode();
+ }
+ InvocationChain chain = getInvocationChain(method);
+ if (chain == null) {
+ throw new IllegalArgumentException("No matching opeeration is found: " + method);
+ }
+
+ // send the invocation down the wire
+ Object result = invoke(chain, args, wire);
+
+ return result;
+ }
+
+ /**
+ * Determines if the given operation matches the given method
+ *
+ * @return true if the operation matches, false if does not
+ */
+ private static boolean match(Operation operation, Method method) {
+ Class<?>[] params = method.getParameterTypes();
+ DataType<List<DataType>> inputType = operation.getInputType();
+ List<DataType> types = inputType.getLogical();
+ boolean matched = true;
+ if (types.size() == params.length && method.getName().equals(operation.getName())) {
+ for (int i = 0; i < params.length; i++) {
+ Class<?> clazz = params[i];
+ if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
+ matched = false;
+ }
+ }
+ } else {
+ matched = false;
+ }
+ return matched;
+
+ }
+
+ private InvocationChain getInvocationChain(Method method) {
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ Operation operation = chain.getSourceOperation();
+ if (match(operation, method)) {
+ return chain;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyService.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyService.java
new file mode 100644
index 0000000000..371f9bedb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyService.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.core.invocation;
+
+import java.lang.reflect.Proxy;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * the default implementation of a wire service that uses JDK dynamic proxies
+ *
+ * @version $$Rev$$ $$Date: 2007-04-11 18:59:43 -0700 (Wed, 11 Apr
+ * 2007) $$
+ */
+public class JDKProxyService implements ProxyFactory {
+ protected InterfaceContractMapper contractMapper;
+ private MessageFactory messageFactory;
+
+ public JDKProxyService() {
+ this(new MessageFactoryImpl(), new InterfaceContractMapperImpl());
+ }
+
+ public JDKProxyService(MessageFactory messageFactory, InterfaceContractMapper mapper) {
+ this.contractMapper = mapper;
+ this.messageFactory = messageFactory;
+ }
+
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
+ assert interfaze != null;
+ assert wire != null;
+ JDKInvocationHandler handler = new JDKInvocationHandler(messageFactory, interfaze, wire);
+ ClassLoader cl = interfaze.getClassLoader();
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler));
+ }
+
+ public Object createCallbackProxy(Class<?> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
+ ClassLoader cl = interfaze.getClassLoader();
+ JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(messageFactory, wires);
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[] {interfaze}, handler));
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ throw new UnsupportedOperationException();
+
+ // InvocationHandler handler = Proxy.getInvocationHandler(target);
+ // if (handler instanceof JDKInvocationHandler) {
+ // // TODO return a ServiceReference
+ // throw new UnsupportedOperationException();
+ // } else if (handler instanceof JDKCallbackInvocationHandler) {
+ // // TODO return a CallbackReference
+ // throw new UnsupportedOperationException();
+ // } else {
+ // throw new IllegalArgumentException("Not a Tuscany SCA proxy");
+ // }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java
new file mode 100644
index 0000000000..6e182a6a14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.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.core.invocation;
+
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * Implementation of MessageFactory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MessageFactoryImpl implements MessageFactory {
+
+ public Message createMessage() {
+ return new MessageImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
new file mode 100644
index 0000000000..a1b2963cf5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.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.core.invocation;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+
+/**
+ * The default implementation of a message flowed through a wire during an invocation
+ *
+ * @version $Rev $Date
+ */
+public class MessageImpl implements Message {
+ private Object body;
+ private Object messageID;
+ private Object correlationID;
+ private boolean isFault;
+ private ConversationSequence conversationSequence;
+ private String conversationId;
+
+ private EndpointReference from;
+ private EndpointReference to;
+
+ public MessageImpl(String conversationId, ConversationSequence conversationSequence, Object body) {
+ this.conversationId = conversationId;
+ this.conversationSequence = conversationSequence;
+ this.body = body;
+ }
+
+ public MessageImpl() {
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getBody() {
+ return (T) body;
+ }
+
+ public <T> void setBody(T body) {
+ this.isFault = false;
+ this.body = body;
+ }
+
+ public String getConversationID() {
+ return conversationId;
+ }
+
+ public void setConversationID(String conversationId) {
+ this.conversationId = conversationId;
+ }
+
+ public ConversationSequence getConversationSequence() {
+ return conversationSequence;
+ }
+
+ public void setConversationSequence(ConversationSequence conversationSequence) {
+ this.conversationSequence = conversationSequence;
+ }
+
+ public Object getMessageID() {
+ return messageID;
+ }
+
+ public void setMessageID(Object messageId) {
+ this.messageID = messageId;
+ }
+
+ public Object getCorrelationID() {
+ return correlationID;
+ }
+
+ public void setCorrelationID(Object correlationId) {
+ this.correlationID = correlationId;
+ }
+
+ public boolean isFault() {
+ return isFault;
+ }
+
+ public void setFaultBody(Object fault) {
+ this.isFault = true;
+ this.body = fault;
+ }
+
+ public EndpointReference getFrom() {
+ return from;
+ }
+
+ public void setFrom(EndpointReference from) {
+ this.from = from;
+ }
+
+ public EndpointReference getTo() {
+ return to;
+ }
+
+ public void setTo(EndpointReference to) {
+ this.to = to;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java
new file mode 100644
index 0000000000..cbeedc086d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.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.core.invocation;
+
+
+/**
+ * Thrown when an {@link org.apache.tuscany.sca.factory.model.Operation} cannot be mapped to a method on an interface
+ * @version $Rev$ $Date$
+ */
+public class NoMethodForOperationException extends ProxyCreationException {
+ private static final long serialVersionUID = 5116536602309483679L;
+
+ public NoMethodForOperationException() {
+ }
+
+ public NoMethodForOperationException(String message) {
+ super(message);
+ }
+
+ public NoMethodForOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoMethodForOperationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
new file mode 100644
index 0000000000..be6f364271
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.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.sca.core.invocation;
+
+import java.util.LinkedList;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Adds non-blocking behavior to an invocation chain
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class NonBlockingInterceptor implements Interceptor {
+
+ private static final Message RESPONSE = new ImmutableMessage();
+
+ private WorkScheduler workScheduler;
+ private Invoker next;
+
+ public NonBlockingInterceptor(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public NonBlockingInterceptor(WorkScheduler workScheduler, Interceptor next) {
+ this.workScheduler = workScheduler;
+ this.next = next;
+ }
+
+ public Message invoke(final Message msg) {
+ // Retrieve conversation id to transfer to new thread
+ // Notice that we cannot clear the conversation id from the current thread
+ final String conversationID = ThreadMessageContext.getMessageContext().getConversationID();
+ // Schedule the invocation of the next interceptor in a new Work instance
+ try {
+ workScheduler.scheduleWork(new Runnable() {
+ public void run() {
+ msg.setCorrelationID(null);
+ // if we got a conversation id, transfer it to new thread
+ if (conversationID != null) {
+ msg.setConversationID(conversationID);
+ }
+ Message context = ThreadMessageContext.setMessageContext(msg);
+ try {
+ next.invoke(msg);
+ } finally {
+ ThreadMessageContext.setMessageContext(context);
+ }
+ }
+ });
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ return RESPONSE;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ /**
+ * A dummy message passed back on an invocation
+ */
+ private static class ImmutableMessage implements Message {
+
+ public String getConversationID() {
+ return null;
+ }
+
+ public RuntimeWire getWire() {
+ return null;
+ }
+
+ public void setConversationID(String conversationId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setWire(RuntimeWire wire) {
+ throw new UnsupportedOperationException();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getBody() {
+ return null;
+ }
+
+ public void setBody(Object body) {
+ if (body != null) {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ public void setCallbackWires(LinkedList<RuntimeWire> wires) {
+
+ }
+
+ public Object getMessageID() {
+ return null;
+ }
+
+ public void setMessageID(Object messageId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getCorrelationID() {
+ return null;
+ }
+
+ public void setCorrelationID(Object correlationId) {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isFault() {
+ return false;
+ }
+
+ public void setFaultBody(Object fault) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setConversationSequence(ConversationSequence sequence) {
+ throw new UnsupportedOperationException();
+ }
+
+ public ConversationSequence getConversationSequence() {
+ return null;
+ }
+
+ public EndpointReference getFrom() {
+ return null;
+ }
+
+ public EndpointReference getTo() {
+ return null;
+ }
+
+ public void setFrom(EndpointReference from) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setTo(EndpointReference to) {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java
new file mode 100644
index 0000000000..4900ae9a7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.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.core.invocation;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+
+
+/**
+ * Denotes an error creating a proxy
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class ProxyCreationException extends ObjectCreationException {
+ private static final long serialVersionUID = 8002454344828513781L;
+
+ public ProxyCreationException() {
+ super();
+ }
+
+ public ProxyCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ProxyCreationException(String message) {
+ super(message);
+ }
+
+ public ProxyCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java
new file mode 100644
index 0000000000..381844ffc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.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.core.invocation;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.osoa.sca.CallableReference;
+
+/**
+ * Creates proxies that implement Java interfaces and invocation handlers for fronting wires
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public interface ProxyFactory {
+
+ /**
+ * Creates a Java proxy for the given wire
+ *
+ * @param interfaze the interface the proxy implements
+ * @param wire the wire to proxy @return the proxy
+ * @throws ProxyCreationException
+ */
+ <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException;
+
+ /**
+ * Creates a Java proxy for the service contract callback
+ *
+ * @param interfaze the interface the proxy should implement
+ * @return the proxy
+ * @throws ProxyCreationException
+ */
+ Object createCallbackProxy(Class<?> interfaze, List<RuntimeWire> wires) throws ProxyCreationException;
+
+ /**
+ * Cast a proxy to a CallableReference.
+ *
+ * @param target a proxy generated by this implementation
+ * @return a CallableReference (or subclass) equivalent to this prozy
+ * @throws IllegalArgumentException if the object supplied is not a proxy
+ */
+ <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
new file mode 100644
index 0000000000..52bea91341
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.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.core.invocation;
+
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Class for tunneling a WorkContext through the invocation of a user class.
+ *
+ * @version $Rev$ $Date$
+ */
+public final class ThreadMessageContext {
+
+ private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>() {
+ protected synchronized Message initialValue() {
+ return new MessageImpl();
+ }
+ };
+
+ private ThreadMessageContext() {
+ }
+
+ /**
+ * Set the WorkContext for the current thread.
+ * The current work context is returned and must be restored after the invocation is complete.
+ * Typical usage would be:
+ * <pre>
+ * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
+ * try {
+ * ... invoke user code ...
+ * } finally {
+ * PojoWorkContextTunnel.setThreadWorkContext(old);
+ * }
+ * </pre>
+ * @param context
+ * @return the current work context for the thread; this must be restored after the invocation is made
+ */
+ public static Message setMessageContext(Message context) {
+ Message old = CONTEXT.get();
+ CONTEXT.set(context);
+ return old;
+ }
+
+ /**
+ * Returns the WorkContext for the current thread.
+ *
+ * @return the WorkContext for the current thread
+ */
+ public static Message getMessageContext() {
+ return CONTEXT.get();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java
new file mode 100644
index 0000000000..e6e41e8f85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.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.core.invocation;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * Uses a wire to return an object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
+ private RuntimeWire wire;
+ private ProxyFactory proxyService;
+ 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, RuntimeWire wire, ProxyFactory proxyService)
+ throws NoMethodForOperationException {
+ this.interfaze = interfaze;
+ this.wire = wire;
+ this.proxyService = proxyService;
+ }
+
+ public T getInstance() throws ObjectCreationException {
+ return interfaze.cast(proxyService.createProxy(interfaze, wire));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/ActivationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/ActivationException.java
new file mode 100644
index 0000000000..987a8288b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/ActivationException.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.core.runtime;
+
+
+/**
+ * Denotes an error starting the runtime
+ *
+ * @version $Rev$ $Date$
+ */
+public class ActivationException extends Exception {
+ private static final long serialVersionUID = 8612661660934426123L;
+
+ public ActivationException(String message) {
+ super(message);
+ }
+
+ public ActivationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivator.java
new file mode 100644
index 0000000000..a390fdebfe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivator.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.core.runtime;
+
+import org.apache.tuscany.sca.assembly.Composite;
+
+/**
+ * Start/stop a composite
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CompositeActivator {
+
+ /**
+ * Activate a composite
+ * @param composite
+ */
+ void activate(Composite composite) throws ActivationException;
+
+ /**
+ * Stop a composite
+ * @param composite
+ */
+ void deactivate(Composite composite) throws ActivationException;
+
+ /**
+ * Start a composite
+ * @param composite
+ */
+ void start(Composite composite) throws ActivationException;
+
+ /**
+ * Stop a composite
+ * @param composite
+ */
+ void stop(Composite composite) throws ActivationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java
new file mode 100644
index 0000000000..5308c6e0f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/CompositeActivatorImpl.java
@@ -0,0 +1,597 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.runtime;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
+import org.apache.tuscany.sca.assembly.builder.CompositeBuilderMonitor;
+import org.apache.tuscany.sca.assembly.builder.Problem;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.scope.ScopeRegistry;
+import org.apache.tuscany.sca.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeActivatorImpl implements CompositeActivator {
+
+ private final AssemblyFactory assemblyFactory;
+ private final SCABindingFactory scaBindingFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+ private final ScopeRegistry scopeRegistry;
+ private final WorkScheduler workScheduler;
+ private final RuntimeWireProcessor wireProcessor;
+ private final ProviderFactoryExtensionPoint providerFactories;
+
+ /**
+ * @param assemblyFactory
+ * @param interfaceContractMapper
+ * @param workContext
+ * @param workScheduler
+ * @param wirePostProcessorRegistry
+ */
+ public CompositeActivatorImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ ScopeRegistry scopeRegistry,
+ WorkScheduler workScheduler,
+ RuntimeWireProcessor wireProcessor,
+ ProviderFactoryExtensionPoint providerFactories) {
+ super();
+ this.assemblyFactory = assemblyFactory;
+ this.scaBindingFactory = scaBindingFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ this.scopeRegistry = scopeRegistry;
+ this.workScheduler = workScheduler;
+ this.wireProcessor = wireProcessor;
+ this.providerFactories = providerFactories;
+ }
+
+ /**
+ * Configure a composite
+ *
+ * @param composite
+ * @throws IncompatibleInterfaceContractException
+ */
+ @SuppressWarnings("unchecked")
+ protected void configureComposite(Composite composite) throws IncompatibleInterfaceContractException {
+ for (Component component : composite.getComponents()) {
+
+ for (ComponentService service : component.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ BindingProviderFactory providerFactory = (BindingProviderFactory)providerFactories
+ .getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ ServiceBindingProvider bindingProvider = providerFactory
+ .createServiceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentService)service,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
+ }
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass()
+ .getName());
+ }
+ }
+ }
+ for (ComponentReference reference : component.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ BindingProviderFactory providerFactory = (BindingProviderFactory)providerFactories
+ .getProviderFactory(binding.getClass());
+ if (providerFactory != null) {
+ ReferenceBindingProvider bindingProvider = providerFactory
+ .createReferenceBindingProvider((RuntimeComponent)component,
+ (RuntimeComponentReference)reference,
+ binding);
+ if (bindingProvider != null) {
+ ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
+ }
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + binding.getClass()
+ .getName());
+ }
+ }
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ configureComposite((Composite)implementation);
+ } else if (implementation != null) {
+ ImplementationProviderFactory providerFactory = (ImplementationProviderFactory)providerFactories
+ .getProviderFactory(implementation.getClass());
+ if (providerFactory != null) {
+ ImplementationProvider implementationProvider = providerFactory
+ .createImplementationProvider((RuntimeComponent)component, implementation);
+ if (implementationProvider != null) {
+ ((RuntimeComponent)component).setImplementationProvider(implementationProvider);
+ }
+ } else {
+ throw new IllegalStateException("Provider factory not found for class: " + implementation
+ .getClass().getName());
+ }
+ setScopeContainer(component);
+ }
+ }
+ }
+
+ /**
+ * Start a composite
+ */
+ protected void startComposite(Composite composite) {
+ for (Component component : composite.getComponents()) {
+
+ for (ComponentService service : component.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service)
+ .getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.start();
+ }
+ }
+ }
+ for (ComponentReference reference : component.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = ((RuntimeComponentReference)reference)
+ .getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.start();
+ }
+ }
+ }
+
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ startComposite((Composite)implementation);
+ } else {
+ ImplementationProvider implementationProvider = ((RuntimeComponent)component)
+ .getImplementationProvider();
+ if (implementationProvider != null) {
+ implementationProvider.start();
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ if (runtimeComponent.getScopeContainer() != null) {
+ runtimeComponent.getScopeContainer().start();
+ }
+ }
+
+ }
+ }
+
+ public void stop(Composite composite) {
+ for (Component component : composite.getComponents()) {
+
+ for (ComponentService service : component.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service)
+ .getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.stop();
+ }
+ }
+ }
+ for (ComponentReference reference : component.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ ReferenceBindingProvider bindingProvider = ((RuntimeComponentReference)reference)
+ .getBindingProvider(binding);
+ if (bindingProvider != null) {
+ bindingProvider.stop();
+ }
+ }
+ }
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ stop((Composite)implementation);
+ } else {
+ ImplementationProvider implementationProvider = ((RuntimeComponent)component)
+ .getImplementationProvider();
+ if (implementationProvider != null) {
+ implementationProvider.stop();
+ }
+ }
+
+ if (component instanceof ScopedRuntimeComponent) {
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ if (runtimeComponent.getScopeContainer() != null) {
+ runtimeComponent.getScopeContainer().stop();
+ }
+ }
+
+ }
+
+ }
+
+ /**
+ * Create runtime wires for the composite
+ *
+ * @param composite
+ * @throws IncompatibleInterfaceContractException
+ */
+ protected void createRuntimeWires(Composite composite) throws IncompatibleInterfaceContractException {
+ for (Component component : composite.getComponents()) {
+ Implementation implementation = component.getImplementation();
+ if (implementation instanceof Composite) {
+ // Recursively create runtime wires
+ createRuntimeWires((Composite)implementation);
+ } else {
+ // Create outbound wires for the component references
+ for (ComponentReference reference : component.getReferences()) {
+ for (Binding binding : reference.getBindings()) {
+ createWires(component, reference, binding);
+ }
+ }
+ // Create inbound wires for the component services
+ for (ComponentService service : component.getServices()) {
+ for (Binding binding : service.getBindings()) {
+ createWires(component, service, binding);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the effective interface contract for a reference binding
+ *
+ * @param reference
+ * @param binding
+ * @return
+ */
+ private InterfaceContract getInterfaceContract(ComponentReference reference, Binding binding) {
+ InterfaceContract interfaceContract = reference.getInterfaceContract();
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ InterfaceContract bindingContract = provider.getBindingInterfaceContract();
+ if (bindingContract != null) {
+ interfaceContract = bindingContract;
+ }
+ }
+ return interfaceContract;
+ }
+
+ /**
+ * Create the runtime wires for a reference binding
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ */
+ private void createWires(Component component, ComponentReference reference, Binding binding) {
+ if (!(reference instanceof RuntimeComponentReference)) {
+ return;
+ }
+ RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
+ InterfaceContract bindingContract = getInterfaceContract(reference, binding);
+
+ if (!(binding instanceof SCABinding)) {
+ InterfaceContract sourceContract = reference.getInterfaceContract();
+
+ // Component Reference --> External Service
+ EndpointReference wireSource = new EndpointReferenceImpl((RuntimeComponent)component,
+ (RuntimeComponentReference)reference, binding,
+ sourceContract);
+
+ EndpointReference wireTarget = new EndpointReferenceImpl(null, null, binding, bindingContract);
+ RuntimeWire wire = new RuntimeWireImpl(wireSource, wireTarget);
+
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(bindingContract.getInterface(), operation);
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+ if (operation.isNonBlocking()) {
+ chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
+ }
+ addBindingInterceptor(component, reference, binding, chain, operation, false);
+ wire.getInvocationChains().add(chain);
+ }
+ if (sourceContract.getCallbackInterface() != null) {
+ for (Operation operation : sourceContract.getCallbackInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(bindingContract.getCallbackInterface(),
+ operation);
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+ if (operation.isNonBlocking()) {
+ chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
+ }
+ addBindingInterceptor(component, reference, binding, chain, operation, true);
+ wire.getCallbackInvocationChains().add(chain);
+ }
+ }
+ runtimeRef.getRuntimeWires().add(wire);
+ wireProcessor.process(wire);
+ }
+ for (ComponentService service : reference.getTargets()) {
+ Component target = null;
+ SCABinding scaBinding = service.getBinding(SCABinding.class);
+ if (scaBinding != null) {
+ target = scaBinding.getComponent();
+ }
+
+ // FIXME: [rfeng] Ignore unresolved services
+ if (service.isUnresolved()) {
+ continue;
+ }
+
+ // FIXME: [rfeng] We might need a better way to get the impl interface contract
+ InterfaceContract targetContract = service.getService().getInterfaceContract();
+
+ EndpointReference wireSource = new EndpointReferenceImpl((RuntimeComponent)component,
+ (RuntimeComponentReference)reference, binding,
+ bindingContract);
+
+ EndpointReference wireTarget = new EndpointReferenceImpl((RuntimeComponent)target,
+ (RuntimeComponentService)service, binding,
+ targetContract);
+
+ RuntimeWire wire = new RuntimeWireImpl(wireSource, wireTarget);
+
+ for (Operation operation : bindingContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+ if (operation.isNonBlocking()) {
+ chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
+ }
+ addBindingInterceptor(component, reference, binding, chain, operation, false);
+ if (target != null) {
+ addImplementationInterceptor(target, service, chain, targetOperation, false);
+ }
+ wire.getInvocationChains().add(chain);
+ }
+ if (bindingContract.getCallbackInterface() != null) {
+ if (reference.getName().startsWith("$self$.")) {
+ // No callback is needed
+ continue;
+ }
+ for (Operation operation : bindingContract.getCallbackInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getCallbackInterface(),
+ operation);
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+ if (operation.isNonBlocking()) {
+ chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
+ }
+ addBindingInterceptor(component, reference, binding, chain, operation, true);
+ addImplementationInterceptor(component, null, chain, targetOperation, true);
+ wire.getCallbackInvocationChains().add(chain);
+ }
+ }
+
+ runtimeRef.getRuntimeWires().add(wire);
+ if (!wire.getCallbackInvocationChains().isEmpty()) {
+ if (wire.getTarget().getContract() != null) {
+ ((RuntimeComponentService) wire.getTarget().getContract()).getCallbackWires().add(wire);
+ }
+ }
+ wireProcessor.process(wire);
+ }
+ }
+
+ /**
+ * Get the effective interface contract for the service binding
+ *
+ * @param service
+ * @param binding
+ * @return
+ */
+ private InterfaceContract getInterfaceContract(ComponentService service, Binding binding) {
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+
+ ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
+ if (provider != null) {
+ InterfaceContract bindingContract = provider.getBindingInterfaceContract();
+ if (bindingContract != null) {
+ interfaceContract = bindingContract;
+ }
+ }
+ return interfaceContract;
+ }
+
+ /**
+ * Create runtime wires for a service binding
+ *
+ * @param component
+ * @param service
+ * @param binding
+ */
+ private void createWires(Component component, ComponentService service, Binding binding) {
+ if (!(service instanceof RuntimeComponentService)) {
+ return;
+ }
+ RuntimeComponentService runtimeService = (RuntimeComponentService)service;
+
+ // FIXME: [rfeng] We might need a better way to get the impl interface contract
+ InterfaceContract targetContract = service.getService().getInterfaceContract();
+
+ InterfaceContract sourceContract = getInterfaceContract(service, binding);
+
+ EndpointReference wireSource = new EndpointReferenceImpl(null, null, binding, sourceContract);
+
+ EndpointReference wireTarget = new EndpointReferenceImpl((RuntimeComponent)component,
+ (RuntimeComponentService)service, binding,
+ targetContract);
+
+ RuntimeWire wire = new RuntimeWireImpl(wireSource, wireTarget);
+
+ for (Operation operation : sourceContract.getInterface().getOperations()) {
+ Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
+ InvocationChain chain = new InvocationChainImpl(operation, targetOperation);
+ /* lresende */
+ if (operation.isNonBlocking()) {
+ chain.addInterceptor(new NonBlockingInterceptor(workScheduler));
+ }
+
+ addImplementationInterceptor(component, service, chain, targetOperation, false);
+ wire.getInvocationChains().add(chain);
+ }
+ // if (sourceContract.getCallbackInterface() != null) {
+ // for (Operation operation :
+ // sourceContract.getCallbackInterface().getOperations()) {
+ // Operation targetOperation =
+ // interfaceContractMapper.map(targetContract.getCallbackInterface(),
+ // operation);
+ // InvocationChain chain = new InvocationChainImpl(operation,
+ // targetOperation);
+ // if (operation.isNonBlocking()) {
+ // chain.addInterceptor(new NonBlockingInterceptor(workScheduler,
+ // workContext));
+ // }
+ // addImplementationInterceptor(component, service, chain, operation,
+ // true);
+ // wire.getCallbackInvocationChains().add(chain);
+ // }
+ // }
+
+ runtimeService.getRuntimeWires().add(wire);
+ wireProcessor.process(wire);
+ }
+
+ /**
+ * Add the interceptor for a component implementation
+ *
+ * @param component
+ * @param service
+ * @param chain
+ * @param operation
+ * @param isCallback
+ */
+ private void addImplementationInterceptor(Component component,
+ ComponentService service,
+ InvocationChain chain,
+ Operation operation,
+ boolean isCallback) {
+ ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
+ if (provider != null) {
+ Invoker invoker = null;
+ if (!isCallback) {
+ invoker = provider.createInvoker((RuntimeComponentService)service, operation);
+ } else {
+ invoker = provider.createCallbackInvoker(operation);
+ }
+ chain.addInvoker(invoker);
+ }
+ }
+
+ /**
+ * Add the interceptor for a binding
+ *
+ * @param component
+ * @param reference
+ * @param binding
+ * @param chain
+ * @param operation
+ * @param isCallback
+ */
+ private void addBindingInterceptor(Component component,
+ ComponentReference reference,
+ Binding binding,
+ InvocationChain chain,
+ Operation operation,
+ boolean isCallback) {
+ ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
+ if (provider != null) {
+ Invoker invoker = provider.createInvoker(operation, isCallback);
+ if (invoker != null) {
+ chain.addInvoker(invoker);
+ }
+ }
+ }
+
+ private void setScopeContainer(Component component) {
+ if (!(component instanceof ScopedRuntimeComponent)) {
+ return;
+ }
+ ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
+ runtimeComponent.setScopeContainer(scopeRegistry.getScopeContainer(runtimeComponent));
+ }
+
+ protected void buildComposite(Composite composite) throws CompositeBuilderException {
+
+ CompositeBuilderMonitor monitor = new CompositeBuilderMonitor() {
+
+ public void problem(Problem problem) {
+ // Uncommenting the following two lines can be useful to detect
+ // and troubleshoot SCA assembly XML composite configuration
+ // problems.
+
+ System.out.println("Composite assembly problem: " + problem.getMessage());
+ }
+ };
+
+ CompositeBuilderImpl builder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, interfaceContractMapper, monitor);
+
+ builder.build(composite);
+
+ // if (!problems.isEmpty()) {
+ // throw new VariantRuntimeException(new RuntimeException("Problems in
+ // the composite..."));
+ // }
+ }
+
+ public void activate(Composite composite) throws ActivationException {
+ try {
+ buildComposite(composite);
+ configureComposite(composite);
+ createRuntimeWires(composite);
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+ public void deactivate(Composite composite) throws ActivationException {
+ }
+
+ public void start(Composite composite) throws ActivationException {
+ try {
+ startComposite(composite);
+ } catch (Exception e) {
+ throw new ActivationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/EndpointReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/EndpointReferenceImpl.java
new file mode 100644
index 0000000000..233f81ccae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/EndpointReferenceImpl.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.sca.core.runtime;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointReferenceImpl implements EndpointReference {
+ private RuntimeComponent component;
+ private Contract contract;
+ private Binding binding;
+ private InterfaceContract interfaceContract;
+ private String uri;
+
+ /**
+ * @param component
+ * @param contract
+ * @param binding
+ * @param interfaceContract
+ */
+ public EndpointReferenceImpl(RuntimeComponent component,
+ Contract contract,
+ Binding binding,
+ InterfaceContract interfaceContract) {
+ super();
+ this.component = component;
+ this.contract = contract;
+ this.binding = binding;
+ this.interfaceContract = interfaceContract;
+ this.uri = binding.getURI();
+ }
+
+ /**
+ * @param uri
+ */
+ public EndpointReferenceImpl(String uri) {
+ super();
+ this.uri = uri;
+ }
+
+ public Binding getBinding() {
+ return binding;
+ }
+
+ public void setBinding(Binding binding) {
+ this.binding = binding;
+ }
+
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+
+ public Contract getContract() {
+ return contract;
+ }
+
+ public void setContract(Contract contract) {
+ this.contract = contract;
+ }
+
+ public InterfaceContract getInterfaceContract() {
+ return interfaceContract;
+ }
+
+ public void setInterfaceContract(InterfaceContract interfaceContract) {
+ this.interfaceContract = interfaceContract;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((uri == null) ? 0 : uri.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ final EndpointReferenceImpl other = (EndpointReferenceImpl)obj;
+ if (uri == null) {
+ if (other.uri != null)
+ return false;
+ } else if (!uri.equals(other.uri))
+ return false;
+ return true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeAssemblyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeAssemblyFactory.java
new file mode 100644
index 0000000000..ec0cdadde6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeAssemblyFactory.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.core.runtime;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements AssemblyFactory {
+ private final ProxyFactory proxyFactory;
+ private final InterfaceContractMapper interfaceContractMapper;
+
+ /**
+ * @param proxyFactory
+ */
+ public RuntimeAssemblyFactory(InterfaceContractMapper interfaceContractMapper, ProxyFactory proxyFactory) {
+ super();
+ this.proxyFactory = proxyFactory;
+ this.interfaceContractMapper = interfaceContractMapper;
+ }
+
+ @Override
+ public Component createComponent() {
+ return new RuntimeComponentImpl(proxyFactory);
+ }
+
+ @Override
+ public ComponentReference createComponentReference() {
+ return new RuntimeComponentReferenceImpl(interfaceContractMapper);
+ }
+
+ @Override
+ public ComponentService createComponentService() {
+ return new RuntimeComponentServiceImpl(interfaceContractMapper);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentImpl.java
new file mode 100644
index 0000000000..aacce904b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentImpl.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.sca.core.runtime;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
+import org.apache.tuscany.sca.core.component.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.WireObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopedRuntimeComponent;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent, ScopedRuntimeComponent {
+ public static final String SELF_REFERENCE_PREFIX = "$self$.";
+ protected ImplementationProvider implementationProvider;
+ protected ProxyFactory proxyService;
+ protected ScopeContainer scopeContainer;
+
+ /**
+ * @param proxyService
+ */
+ public RuntimeComponentImpl(ProxyFactory proxyService) {
+ super();
+ this.proxyService = proxyService;
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ return getServiceReference(businessInterface, SELF_REFERENCE_PREFIX);
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
+ return getServiceReference(businessInterface, SELF_REFERENCE_PREFIX + serviceName);
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ for (Property p : getProperties()) {
+ if (p.getName().equals(propertyName)) {
+ // FIXME: Need to use the property object factory to create the
+ // instance
+ return null;
+ }
+ }
+ return null;
+ }
+
+ public RequestContext getRequestContext() {
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String referenceName) {
+ List<ComponentReference> refs = getReferences();
+ for (ComponentReference ref : refs) {
+ if (ref.getName().equals(referenceName)) {
+ RuntimeComponentReference attachPoint = (RuntimeComponentReference)ref;
+ RuntimeWire wire = attachPoint.getRuntimeWires().get(0);
+ return proxyService.createProxy(businessInterface, wire);
+ }
+ }
+ return null;
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ List<ComponentReference> references = getReferences();
+ for (ComponentReference reference : references) {
+ if (reference.getName().equals(referenceName) || referenceName.equals("$self$.")
+ && reference.getName().startsWith(referenceName)) {
+ RuntimeComponentReference attachPoint = (RuntimeComponentReference)reference;
+ RuntimeWire wire = attachPoint.getRuntimeWires().get(0);
+ WireObjectFactory<B> factory = new WireObjectFactory<B>(businessInterface, wire, proxyService);
+ return new ServiceReferenceImpl<B>(businessInterface, factory);
+ }
+ }
+ return null;
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ Object ref = proxyService.cast(target);
+ return (R)ref;
+ }
+
+ public ImplementationProvider getImplementationProvider() {
+ return implementationProvider;
+ }
+
+ public void setImplementationProvider(ImplementationProvider provider) {
+ this.implementationProvider = provider;
+ }
+
+ public ScopeContainer getScopeContainer() {
+ return scopeContainer;
+ }
+
+ public void setScopeContainer(ScopeContainer scopeContainer) {
+ this.scopeContainer = scopeContainer;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentReferenceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentReferenceImpl.java
new file mode 100644
index 0000000000..128ae29b81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentReferenceImpl.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.sca.core.runtime;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implements RuntimeComponentReference {
+ private List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ private Map<Binding, ReferenceBindingProvider> bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
+ private InterfaceContractMapper mapper;
+
+ public RuntimeComponentReferenceImpl(InterfaceContractMapper mapper) {
+ super();
+ this.mapper = mapper;
+ }
+
+ public void addRuntimeWire(RuntimeWire wire) {
+ wires.add(wire);
+ }
+
+ public List<RuntimeWire> getRuntimeWires() {
+ return wires;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding) {
+ for (RuntimeWire wire : wires) {
+ if (wire.getSource().getBinding() == binding) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public ReferenceBindingProvider getBindingProvider(Binding binding) {
+ return bindingProviders.get(binding);
+ }
+
+ public void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider) {
+ bindingProviders.put(binding, bindingProvider);
+ }
+
+ public Invoker getInvoker(Binding binding, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ Operation op = chain.getSourceOperation();
+ if (mapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
+ return chain.getHeadInvoker();
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentServiceImpl.java
new file mode 100644
index 0000000000..0bb8e2c457
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeComponentServiceImpl.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.sca.core.runtime;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements RuntimeComponentService {
+ private InterfaceContractMapper mapper;
+
+ public RuntimeComponentServiceImpl(InterfaceContractMapper mapper) {
+ super();
+ this.mapper = mapper;
+ }
+
+ private List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ private List<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
+ private Map<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
+
+ public void addRuntimeWire(RuntimeWire wire) {
+ wires.add(wire);
+ }
+
+ public List<RuntimeWire> getRuntimeWires() {
+ return wires;
+ }
+
+ public RuntimeWire getRuntimeWire(Binding binding) {
+ for (RuntimeWire wire : wires) {
+ if (wire.getTarget().getBinding() == binding) {
+ return wire;
+ }
+ }
+ return null;
+ }
+
+ public List<RuntimeWire> getCallbackWires() {
+ return callbackWires;
+ }
+
+ public void addCallbackWire(RuntimeWire callbackWire) {
+ this.callbackWires.add(callbackWire);
+ }
+
+ public ServiceBindingProvider getBindingProvider(Binding binding) {
+ return bindingProviders.get(binding);
+ }
+
+ public void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider) {
+ bindingProviders.put(binding, bindingProvider);
+ }
+
+ public Invoker getInvoker(Binding binding, Operation operation) {
+ RuntimeWire wire = getRuntimeWire(binding);
+ if (wire == null) {
+ return null;
+ }
+ for (InvocationChain chain : wire.getInvocationChains()) {
+ Operation op = chain.getTargetOperation();
+ if (mapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
+ return chain.getHeadInvoker();
+ }
+ }
+ return null;
+ }
+
+ public Invoker getCallbackInvoker(Binding binding, Operation operation) {
+ for (RuntimeWire wire : callbackWires) {
+ if (wire.getTarget().getBinding() == binding) {
+ for (InvocationChain chain : wire.getCallbackInvocationChains()) {
+ Operation op = chain.getSourceOperation();
+ if (mapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
+ return chain.getHeadInvoker();
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProvider.java
new file mode 100644
index 0000000000..ad055731f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProvider.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.core.runtime;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public RuntimeSCABindingProvider(RuntimeComponent component, RuntimeComponentReference reference, SCABinding binding) {
+ this.reference = reference;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ return null;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProviderFactory.java
new file mode 100644
index 0000000000..06b7b3d40e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeSCABindingProviderFactory.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.core.runtime;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ SCABinding binding) {
+ return new RuntimeSCABindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ SCABinding binding) {
+ return null;
+ }
+
+ public Class<SCABinding> getModelType() {
+ return SCABinding.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeWireImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeWireImpl.java
new file mode 100644
index 0000000000..cdf7ec01c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/RuntimeWireImpl.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.sca.core.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.runtime.EndpointReference;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RuntimeWireImpl implements RuntimeWire {
+ private EndpointReference wireSource;
+ private EndpointReference wireTarget;
+
+ private final List<InvocationChain> chains = new ArrayList<InvocationChain>();
+ private final List<InvocationChain> callbackChains = new ArrayList<InvocationChain>();
+
+ /**
+ * @param source
+ * @param target
+ */
+ public RuntimeWireImpl(EndpointReference source,
+ EndpointReference target) {
+ super();
+ this.wireSource = source;
+ this.wireTarget = target;
+ }
+
+ public List<InvocationChain> getCallbackInvocationChains() {
+ return callbackChains;
+ }
+
+ public List<InvocationChain> getInvocationChains() {
+ return chains;
+ }
+
+ public EndpointReference getSource() {
+ return wireSource;
+ }
+
+ public EndpointReference getTarget() {
+ return wireTarget;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
new file mode 100644
index 0000000000..1d776b729c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.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.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.AbstractLifecycle;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.PersistenceException;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * Implements functionality common to scope contexts.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractScopeContainer<KEY> extends AbstractLifecycle implements ScopeContainer<KEY> {
+ protected Map<KEY, InstanceWrapper<?>> wrappers = new ConcurrentHashMap<KEY, InstanceWrapper<?>>();
+ protected final Scope scope;
+
+ protected RuntimeComponent component;
+
+ public AbstractScopeContainer(Scope scope, RuntimeComponent component) {
+ this.scope = scope;
+ this.component = component;
+ }
+
+ protected void checkInit() {
+ if (getLifecycleState() != RUNNING) {
+ throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]");
+ }
+ }
+
+ /**
+ * Creates a new physical instance of a component, wrapped in an
+ * InstanceWrapper.
+ *
+ * @param component the component whose instance should be created
+ * @return a wrapped instance that has been injected but not yet started
+ * @throws TargetResolutionException if there was a problem creating the
+ * instance
+ */
+ protected InstanceWrapper createInstanceWrapper() throws TargetResolutionException {
+ ImplementationProvider implementationProvider = component.getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ return ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
+ }
+ return null;
+ }
+
+ public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
+ return null;
+ }
+
+ public Scope getScope() {
+ return scope;
+ }
+
+ public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ return wrappers.get(contextId);
+ }
+
+ public void onEvent(Event event) {
+ }
+
+ protected boolean isEagerInit() {
+ ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ return ((ScopedImplementationProvider)implementationProvider).isEagerInit();
+ }
+ return false;
+ }
+
+ public void remove() throws PersistenceException {
+ throw new UnsupportedOperationException("Scope does not support persistence");
+ }
+
+ public void returnWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetDestructionException {
+ }
+
+ public synchronized void start() {
+ int lifecycleState = getLifecycleState();
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ setLifecycleState(RUNNING);
+ }
+
+ public void startContext(KEY contextId) {
+ if(isEagerInit()) {
+ try {
+ getWrapper(contextId);
+ } catch (TargetResolutionException e) {
+ //
+ }
+ }
+ }
+
+ public synchronized void stop() {
+ int lifecycleState = getLifecycleState();
+ if (lifecycleState != RUNNING) {
+ throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]");
+ }
+ setLifecycleState(STOPPED);
+ }
+
+ public void stopContext(KEY contextId) {
+ wrappers.remove(contextId);
+ }
+
+ public String toString() {
+ return "In state [" + super.toString() + ']';
+ }
+
+ public RuntimeComponent getComponent() {
+ return component;
+ }
+
+ public void setComponent(RuntimeComponent component) {
+ this.component = component;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
new file mode 100644
index 0000000000..520d3ab48c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.TargetNotFoundException;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * A scope context which manages atomic component instances keyed by composite
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
+ private InstanceWrapper<?> wrapper;
+
+ public CompositeScopeContainer(RuntimeComponent component) {
+ super(Scope.COMPOSITE, component);
+ }
+
+ public synchronized void stop() {
+ super.stop();
+ wrapper = null;
+ }
+
+ public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
+ if (wrapper == null) {
+ wrapper = createInstanceWrapper();
+ wrapper.start();
+ }
+ return wrapper;
+ }
+
+ public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
+ if (wrapper == null) {
+ throw new TargetNotFoundException(component.getURI());
+ }
+ return wrapper;
+ }
+
+ @Override
+ public synchronized void start() {
+ super.start();
+ if(isEagerInit()) {
+ try {
+ getWrapper(null);
+ } catch (TargetResolutionException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java
new file mode 100644
index 0000000000..7078903b8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CompositeScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new CompositeScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.COMPOSITE;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
new file mode 100644
index 0000000000..61f7d51c29
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.scope;
+
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.PersistenceException;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+import org.apache.tuscany.sca.store.Store;
+import org.apache.tuscany.sca.store.StoreExpirationEvent;
+
+/**
+ * A scope context which manages atomic component instances keyed on a
+ * conversation session
+ *
+ * @version $Rev: 452655 $ $Date: 2006-10-03 18:09:02 -0400 (Tue, 03 Oct 2006) $
+ */
+public class ConversationalScopeContainer extends AbstractScopeContainer implements ScopeContainer {
+ private final Store nonDurableStore;
+
+ public ConversationalScopeContainer(Store store, RuntimeComponent component) {
+ super(Scope.CONVERSATION, component);
+ this.nonDurableStore = store;
+ if (store != null) {
+ store.addListener(new ExpirationListener());
+ }
+ }
+
+ public void onEvent(Event event) {
+ checkInit();
+ }
+
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ public synchronized void stop() {
+ lifecycleState = STOPPED;
+ }
+
+ public void persistNew(RuntimeComponent component, String id, Object instance, long expiration)
+ throws PersistenceException {
+ // try {
+ // nonDurableStore.insertRecord(component, id, instance, expiration);
+ // } catch (StoreWriteException e) {
+ // throw new PersistenceException(e);
+ // }
+ }
+
+ public void persist(RuntimeComponent component, String id, Object instance, long expiration)
+ throws PersistenceException {
+ // try {
+ // nonDurableStore.updateRecord(component, id, instance, expiration);
+ // } catch (StoreWriteException e) {
+ // throw new PersistenceException(e);
+ // }
+ }
+
+ public void remove(RuntimeComponent component) throws PersistenceException {
+ // String conversationId = getConversationId();
+ // try {
+ // workContext.setCurrentAtomicComponent(component);
+ // // FIXME this should be an InstanceWrapper and shouldn't we stop it?
+ // Object instance = nonDurableStore.readRecord(component,
+ // conversationId);
+ // if (instance != null) {
+ // nonDurableStore.removeRecord(component, conversationId);
+ // }
+ // } catch (StoreReadException e) {
+ // throw new PersistenceException(e);
+ // } catch (StoreWriteException e) {
+ // throw new PersistenceException(e);
+ // }
+ }
+
+ protected InstanceWrapper getInstanceWrapper(RuntimeComponent component, boolean create)
+ throws TargetResolutionException {
+ throw new UnsupportedOperationException("To be implemented");
+ // String conversationId = getConversationId();
+ // try {
+ // workContext.setCurrentAtomicComponent(component);
+ // InstanceWrapper wrapper = (InstanceWrapper)
+ // nonDurableStore.readRecord(component, conversationId);
+ // if (wrapper != null) {
+ // if (component.getMaxIdleTime() > 0) {
+ // // update expiration
+ // long expire = System.currentTimeMillis() +
+ // component.getMaxIdleTime();
+ // nonDurableStore.updateRecord(component, conversationId, wrapper,
+ // expire);
+ // }
+ // } else if (create) {
+ // // FIXME should the store really be persisting the wrappers
+ // wrapper = component.createInstanceWrapper();
+ // wrapper.start();
+ // long expire = calculateExpiration(component);
+ // nonDurableStore.insertRecord(component, conversationId, wrapper,
+ // expire);
+ // }
+ // return wrapper;
+ // } catch (StoreReadException e) {
+ // throw new TargetResolutionException("Error retrieving target
+ // instance", e);
+ // } catch (StoreWriteException e) {
+ // throw new TargetResolutionException("Error persisting target
+ // instance", e);
+ // } finally {
+ // workContext.setCurrentAtomicComponent(null);
+ // }
+ }
+
+ /**
+ * Returns the conversation id associated with the current invocation
+ * context
+ *
+ * @return the conversation id
+ */
+ private String getConversationId() {
+ String conversationId = ThreadMessageContext.getMessageContext().getConversationID();
+ assert conversationId != null;
+ return conversationId;
+ }
+
+ // private long calculateExpiration(RuntimeComponent component) {
+ // if (component.getMaxAge() > 0) {
+ // long now = System.currentTimeMillis();
+ // return now + component.getMaxAge();
+ // } else if (component.getMaxIdleTime() > 0) {
+ // long now = System.currentTimeMillis();
+ // return now + component.getMaxIdleTime();
+ // } else {
+ // return Store.DEFAULT_EXPIRATION_OFFSET;
+ // }
+ // }
+
+ /**
+ * Receives expiration events from the store and notifies the corresponding
+ * atomic component
+ */
+ private static class ExpirationListener implements RuntimeEventListener {
+
+ public ExpirationListener() {
+ }
+
+ public void onEvent(Event event) {
+ if (event instanceof StoreExpirationEvent) {
+ StoreExpirationEvent expiration = (StoreExpirationEvent)event;
+ InstanceWrapper wrapper = (InstanceWrapper)expiration.getInstance();
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ // monitor.destructionError(e);
+ }
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
new file mode 100644
index 0000000000..4fdda90bc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.store.Store;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalScopeContainerFactory implements ScopeContainerFactory {
+ private Store store;
+
+ public ConversationalScopeContainerFactory(Store store) {
+ super();
+ this.store = store;
+ }
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new ConversationalScopeContainer(store, component);
+ }
+
+ public Scope getScope() {
+ return Scope.CONVERSATION;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
new file mode 100644
index 0000000000..bcbf3cdf3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.core.event.HttpSessionEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * A scope context which manages atomic component instances keyed on HTTP
+ * session
+ *
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeContainer extends AbstractScopeContainer<Object> {
+
+ public HttpSessionScopeContainer(RuntimeComponent component) {
+ super(Scope.SESSION, component);
+ }
+
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof HttpSessionEnd) {
+ Object key = ((HttpSessionEnd)event).getSessionID();
+ // FIXME: Remove the session id
+ }
+ }
+
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ public synchronized void stop() {
+ lifecycleState = STOPPED;
+ }
+
+ protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
+// Object key = workContext.getIdentifier(Scope.SESSION);
+ // FIXME: Need to fix this
+ Object key ="http-session-id";
+ assert key != null : "HTTP session key not bound in work context";
+ InstanceWrapper ctx = wrappers.get(key);
+ if (ctx == null && !create) {
+ return null;
+ }
+ if (ctx == null) {
+ ctx = super.createInstanceWrapper();
+ ctx.start();
+ wrappers.put(key, ctx);
+ }
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java
new file mode 100644
index 0000000000..e275bb56b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.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.sca.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HttpSessionScopeContainerFactory implements ScopeContainerFactory {
+
+ public HttpSessionScopeContainerFactory() {
+ super();
+ }
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new HttpSessionScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.SESSION;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
new file mode 100644
index 0000000000..aaafb4603c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.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.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.core.event.RequestEnd;
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * A scope context which manages atomic component instances keyed on the current
+ * request context
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeContainer extends AbstractScopeContainer<Thread> {
+ private final Map<Thread, InstanceWrapper> contexts;
+
+ public RequestScopeContainer(RuntimeComponent component) {
+ super(Scope.REQUEST, component);
+ contexts = new ConcurrentHashMap<Thread, InstanceWrapper>();
+ }
+
+ public void onEvent(Event event) {
+ checkInit();
+ if (event instanceof RequestEnd) {
+ // shutdownInstances(Thread.currentThread());
+ }
+ }
+
+ public synchronized void start() {
+ if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
+ throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
+ }
+ lifecycleState = RUNNING;
+ }
+
+ public synchronized void stop() {
+ contexts.clear();
+ // synchronized (destroyQueues) {
+ // destroyQueues.clear();
+ // }
+ lifecycleState = STOPPED;
+ }
+
+ protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
+ InstanceWrapper ctx = wrappers.get(Thread.currentThread());
+ if (ctx == null && !create) {
+ return null;
+ }
+ if (ctx == null) {
+ ctx = super.createInstanceWrapper();
+ ctx.start();
+ wrappers.put(Thread.currentThread(), ctx);
+ }
+ return ctx;
+ }
+
+ @Override
+ public InstanceWrapper getWrapper(Thread contextId) throws TargetResolutionException {
+ return getInstanceWrapper(true);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java
new file mode 100644
index 0000000000..3851637220
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new RequestScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.REQUEST;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java
new file mode 100644
index 0000000000..774c1edf37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.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.core.scope;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.scope.ScopeRegistry;
+import org.apache.tuscany.sca.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.scope.ScopedRuntimeComponent;
+
+/**
+ * The default implementation of a scope registry
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeRegistryImpl implements ScopeRegistry {
+ private final Map<Scope, ScopeContainerFactory> scopeCache = new ConcurrentHashMap<Scope, ScopeContainerFactory>();
+
+ public void register(ScopeContainerFactory factory) {
+ scopeCache.put(factory.getScope(), factory);
+ }
+
+ public ScopeContainer getScopeContainer(RuntimeComponent runtimeComponent) {
+ if (!(runtimeComponent instanceof ScopedRuntimeComponent)) {
+ return null;
+ }
+ ScopedRuntimeComponent component = (ScopedRuntimeComponent)runtimeComponent;
+ if (component.getScopeContainer() != null) {
+ return component.getScopeContainer();
+ }
+ ImplementationProvider implementationProvider = component.getImplementationProvider();
+ if (implementationProvider instanceof ScopedImplementationProvider) {
+ ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
+ Scope scope = provider.getScope();
+ if (scope == null) {
+ scope = Scope.STATELESS;
+ }
+ ScopeContainerFactory factory = scopeCache.get(scope);
+ ScopeContainer container = factory.createScopeContainer(component);
+ component.setScopeContainer(container);
+ return container;
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java
new file mode 100644
index 0000000000..dd481fa062
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * A scope context which manages stateless atomic component instances in a non-pooled fashion.
+ *
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
+
+ public StatelessScopeContainer(RuntimeComponent component) {
+ super(Scope.STATELESS, component);
+ }
+
+ public InstanceWrapper getWrapper(KEY contextId)
+ throws TargetResolutionException {
+ InstanceWrapper ctx = createInstanceWrapper();
+ ctx.start();
+ return ctx;
+ }
+
+ public InstanceWrapper getAssociatedWrapper(KEY contextId)
+ throws TargetResolutionException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetDestructionException {
+ wrapper.stop();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java
new file mode 100644
index 0000000000..e0eff710e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.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.core.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessScopeContainerFactory implements ScopeContainerFactory {
+
+ public ScopeContainer createScopeContainer(RuntimeComponent component) {
+ return new StatelessScopeContainer(component);
+ }
+
+ public Scope getScope() {
+ return Scope.STATELESS;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
new file mode 100644
index 0000000000..5b838116c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.core.store;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.tuscany.sca.core.event.BaseEventPublisher;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.DuplicateRecordException;
+import org.apache.tuscany.sca.store.RecoveryListener;
+import org.apache.tuscany.sca.store.Store;
+import org.apache.tuscany.sca.store.StoreExpirationEvent;
+import org.apache.tuscany.sca.store.StoreMonitor;
+import org.apache.tuscany.sca.store.StoreWriteException;
+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;
+
+/**
+ * Implements a non-durable, non-transactional store using a simple in-memory map
+ *
+ * @version $Rev$ $Date$
+ */
+@Service(Store.class)
+@EagerInit
+public class MemoryStore extends BaseEventPublisher implements Store {
+ private Map<RuntimeComponent, Map<String, Record>> store;
+ // TODO integrate with a core threading scheme
+ private ScheduledExecutorService scheduler;
+ private long reaperInterval = 300000;
+ private StoreMonitor monitor;
+ private long defaultExpirationOffset = 600000; // 10 minutes
+
+ public MemoryStore(StoreMonitor monitor) {
+ this.monitor = monitor;
+ this.store = new ConcurrentHashMap<RuntimeComponent, Map<String, Record>>();
+ this.scheduler = Executors.newSingleThreadScheduledExecutor();
+ }
+
+ /**
+ * Returns the maximum default expiration offset for records in the store
+ *
+ * @return the maximum default expiration offset for records in the store
+ */
+ public long getDefaultExpirationOffset() {
+ return defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the maximum default expiration offset for records in the store
+ */
+ @Property
+ public void setDefaultExpirationOffset(long defaultExpirationOffset) {
+ this.defaultExpirationOffset = defaultExpirationOffset;
+ }
+
+ /**
+ * Sets the interval for expired entry scanning to be performed
+ */
+ @Property
+ public void setReaperInterval(long reaperInterval) {
+ this.reaperInterval = reaperInterval;
+ }
+
+ public long getReaperInterval() {
+ return reaperInterval;
+ }
+
+ @Init
+ public void init() {
+ scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS);
+ monitor.start("In-memory store started");
+ }
+
+ @Destroy
+ public void destroy() {
+ scheduler.shutdown();
+ monitor.stop("In-memory store stopped");
+ }
+
+ public void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ map = new ConcurrentHashMap<String, Record>();
+ store.put(owner, map);
+ }
+ if (map.containsKey(id)) {
+ throw new DuplicateRecordException("Duplicate record: " + owner.getURI() +" : " + id);
+ }
+ map.put(id, new Record(object, expiration));
+ }
+
+ public void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
+ }
+ Record record = map.get(id);
+ if (record == null) {
+ throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
+ }
+ record.data = object;
+ }
+
+ public Object readRecord(RuntimeComponent owner, String id) {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ return null;
+ }
+ Record record = map.get(id);
+ if (record != null) {
+ return record.data;
+ }
+ return null;
+ }
+
+ public void removeRecords() {
+ store.clear();
+ }
+
+ public void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException {
+ Map<String, Record> map = store.get(owner);
+ if (map == null) {
+ throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
+ }
+ if (map.remove(id) == null) {
+ throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
+ }
+ }
+
+ public void recover(RecoveryListener listener) {
+ throw new UnsupportedOperationException();
+ }
+
+ private class Record {
+ private Object data;
+ private long expiration = NEVER;
+
+ public Record(Object data, long expiration) {
+ this.data = data;
+ this.expiration = expiration;
+ }
+
+ public Object getData() {
+ return data;
+ }
+
+ public long getExpiration() {
+ return expiration;
+ }
+ }
+
+ private class Reaper implements Runnable {
+
+ public void run() {
+ long now = System.currentTimeMillis();
+ for (Map.Entry<RuntimeComponent, Map<String, Record>> entries : store.entrySet()) {
+ for (Map.Entry<String, Record> entry : entries.getValue().entrySet()) {
+ final long expiration = entry.getValue().expiration;
+ if (expiration != NEVER && now >= expiration) {
+ RuntimeComponent owner = entries.getKey();
+ Object instance = entry.getValue().getData();
+ // notify listeners of the expiration
+ StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance);
+ publish(event);
+ entries.getValue().remove(entry.getKey());
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/util/IOHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/util/IOHelper.java
new file mode 100644
index 0000000000..2058397fb0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/util/IOHelper.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.core.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+public class IOHelper {
+ /**
+ * The default buffer size to use.
+ */
+ private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
+
+ protected IOHelper() {
+
+ }
+
+ /**
+ * Unconditionally close an <code>InputStream</code>.
+ * <p>
+ * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param input the InputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(InputStream input) {
+ try {
+ if (input != null) {
+ input.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Unconditionally close an <code>OutputStream</code>.
+ * <p>
+ * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
+ * This is typically used in finally blocks.
+ *
+ * @param output the OutputStream to close, may be null or already closed
+ */
+ public static void closeQuietly(OutputStream output) {
+ try {
+ if (output != null) {
+ output.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ /**
+ * Copy bytes from an <code>InputStream</code> to an
+ * <code>OutputStream</code>.
+ * <p>
+ * This method buffers the input internally, so there is no need to use a
+ * <code>BufferedInputStream</code>.
+ *
+ * @param input the <code>InputStream</code> to read from
+ * @param output the <code>OutputStream</code> to write to
+ * @return the number of bytes copied
+ * @throws NullPointerException if the input or output is null
+ * @throws IOException if an I/O error occurs
+ * @since Commons IO 1.1
+ */
+ public static int copy(InputStream input, OutputStream output) throws IOException {
+ byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
+ int count = 0;
+ int n = 0;
+ while (-1 != (n = input.read(buffer))) { // NOPMD
+ output.write(buffer, 0, n);
+ count += n;
+ }
+ return count;
+ }
+
+ public static InputStream getInputStream(URL url) throws IOException {
+ return new SafeURLInputStream(url);
+ }
+
+ /**
+ * This class is a workaround for URL stream issue as illustrated below.
+ * InputStream is=url.getInputStream(); is.close(); // This line doesn't close
+ * the JAR file if the URL is a jar entry like "jar:file:/a.jar!/my.composite" We
+ * also need to turn off the JarFile cache.
+ *
+ * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4950148
+ *
+ * @version $Rev$ $Date$
+ */
+ public static class SafeURLInputStream extends InputStream {
+ private JarFile jarFile;
+ private InputStream is;
+
+ public SafeURLInputStream(URL url) throws IOException {
+ String protocol = url.getProtocol();
+ if (protocol != null && (protocol.equals("jar"))) {
+ JarURLConnection connection = (JarURLConnection)url.openConnection();
+ // We cannot use cache
+ connection.setUseCaches(false);
+ try {
+ is = connection.getInputStream();
+ } catch (IOException e) {
+ throw e;
+ }
+ jarFile = connection.getJarFile();
+ } else {
+ is = url.openStream();
+ }
+ }
+
+ public SafeURLInputStream(JarURLConnection connection) throws IOException {
+ // We cannot use cache
+ connection.setUseCaches(false);
+ is = connection.getInputStream();
+ jarFile = connection.getJarFile();
+ }
+
+ public int available() throws IOException {
+ return is.available();
+ }
+
+ public void close() throws IOException {
+ is.close();
+ // We need to close the JAR file
+ if (jarFile != null) {
+ jarFile.close();
+ }
+ }
+
+ public synchronized void mark(int readlimit) {
+ is.mark(readlimit);
+ }
+
+ public boolean markSupported() {
+ return is.markSupported();
+ }
+
+ public int read() throws IOException {
+ return is.read();
+ }
+
+ public int read(byte[] b, int off, int len) throws IOException {
+ return is.read(b, off, len);
+ }
+
+ public int read(byte[] b) throws IOException {
+ return is.read(b);
+ }
+
+ public synchronized void reset() throws IOException {
+ is.reset();
+ }
+
+ public long skip(long n) throws IOException {
+ return is.skip(n);
+ }
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.java
new file mode 100644
index 0000000000..6fe883157f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237Work.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.core.work;
+
+/*
+ * JCA work wrapper.
+ */
+public class Jsr237Work<T extends Runnable> implements commonj.work.Work {
+
+ // Work that is being executed.
+ private T work;
+
+ /*
+ * Initializes the work instance.
+ */
+ public Jsr237Work(T work) {
+ this.work = work;
+ }
+
+ /*
+ * Returns the completed work.
+ */
+ public T getWork() {
+ return work;
+ }
+
+ /*
+ * Release the work.
+ */
+ public void release() {
+ }
+
+ /*
+ * Work attributes are not daemon.
+ */
+ public boolean isDaemon() {
+ return false;
+ }
+
+ /*
+ * Runs the work.
+ */
+ public void run() {
+ work.run();
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
new file mode 100644
index 0000000000..c8a5dd7afe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Jsr237WorkScheduler.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.core.work;
+
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.apache.tuscany.sca.work.WorkSchedulerException;
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+
+/**
+ * A work scheduler implementation based on a JSR 237 work manager.
+ * <p/>
+ * <p/>
+ * This needs a JSR 237 work manager implementation available for scheduling work. Instances can be configured with a
+ * work manager implementation that is injected in. It is the responsibility of the runtime environment to make a work
+ * manager implementaion available. For example, if the managed environment supports work manager the runtime can use
+ * the appropriate lookup mechanism to inject the work manager implementation. </p>
+ */
+public class Jsr237WorkScheduler implements WorkScheduler {
+
+ /**
+ * Underlying JSR-237 work manager
+ */
+ private WorkManager jsr237WorkManager;
+
+ /**
+ * Initializes the JSR 237 work manager.
+ *
+ * @param jsr237WorkManager JSR 237 work manager.
+ */
+ public Jsr237WorkScheduler(WorkManager jsr237WorkManager) {
+ if (jsr237WorkManager == null) {
+ throw new IllegalArgumentException("Work manager cannot be null");
+ }
+ this.jsr237WorkManager = jsr237WorkManager;
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ */
+ public <T extends Runnable> void scheduleWork(T work) {
+ scheduleWork(work, null);
+ }
+
+ /**
+ * Schedules a unit of work for future execution. The notification listener is used to register interest in
+ * callbacks regarding the status of the work.
+ *
+ * @param work The unit of work that needs to be asynchronously executed.
+ * @param listener Notification listener for callbacks.
+ */
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+
+ if (work == null) {
+ throw new IllegalArgumentException("Work cannot be null");
+ }
+
+ Jsr237Work<T> jsr237Work = new Jsr237Work<T>(work);
+ try {
+ if (listener == null) {
+ jsr237WorkManager.schedule(jsr237Work);
+ } else {
+ Jsr237WorkListener<T> jsr237WorkListener = new Jsr237WorkListener<T>(listener, work);
+ jsr237WorkManager.schedule(jsr237Work, jsr237WorkListener);
+ }
+ } catch (WorkRejectedException ex) {
+ if (listener != null) {
+ listener.workRejected(work);
+ } else {
+ throw new WorkSchedulerException(ex);
+ }
+ } catch (WorkException ex) {
+ throw new WorkSchedulerException(ex);
+ }
+
+ }
+
+ /*
+ * Worklistener for keeping track of work status callbacks.
+ *
+ */
+ private class Jsr237WorkListener<T extends Runnable> implements WorkListener {
+
+ // Notification listener
+ private NotificationListener<T> listener;
+
+ // Work
+ private T work;
+
+ /*
+ * Initializes the notification listener.
+ */
+ public Jsr237WorkListener(NotificationListener<T> listener, T work) {
+ this.listener = listener;
+ this.work = work;
+ }
+
+ /*
+ * Callback when the work is accepted.
+ */
+ public void workAccepted(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workAccepted(work);
+ }
+
+ /*
+ * Callback when the work is rejected.
+ */
+ public void workRejected(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workRejected(work);
+ }
+
+ /*
+ * Callback when the work is started.
+ */
+ public void workStarted(WorkEvent workEvent) {
+ T work = getWork();
+ listener.workStarted(work);
+ }
+
+ /*
+ * Callback when the work is completed.
+ */
+ public void workCompleted(WorkEvent workEvent) {
+ T work = getWork();
+ Exception exception = workEvent.getException();
+ if (exception != null) {
+ listener.workFailed(work, exception);
+ } else {
+ listener.workCompleted(work);
+ }
+ }
+
+ /*
+ * Gets the underlying work from the work event.
+ */
+ private T getWork() {
+ return work;
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java
new file mode 100644
index 0000000000..0bc6f1b336
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.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.sca.core.work;
+
+import java.rmi.server.UID;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Property;
+
+import commonj.work.Work;
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+import commonj.work.WorkListener;
+import commonj.work.WorkManager;
+import commonj.work.WorkRejectedException;
+
+/**
+ * A thread-pool based implementation for the JSR-237 work manager.
+ * <p/>
+ * <p/>
+ * This implementation supports only local work.
+ * <p/>
+ * TODO Elaborate the implementation. </p>
+ */
+public class ThreadPoolWorkManager implements WorkManager {
+
+ // Map of work items currently handled by the work manager
+ private Map<WorkItemImpl, WorkListener> workItems = new ConcurrentHashMap<WorkItemImpl, WorkListener>();
+
+ // Thread-pool
+ private ExecutorService executor;
+
+ /**
+ * Initializes the thread-pool.
+ *
+ * @param threadPoolSize Thread-pool size.
+ */
+ public ThreadPoolWorkManager(@Property(name = "poolSize") int threadPoolSize) {
+ executor = Executors.newFixedThreadPool(threadPoolSize);
+ }
+
+ /**
+ * Schedules a unit of work asynchronously.
+ *
+ * @param work Work that needs to be scheduled.
+ * @return Work Work item representing the asynchronous work
+ */
+ public WorkItem schedule(Work work) throws WorkException {
+ return schedule(work, null);
+ }
+
+ /**
+ * Schedules a unit of work asynchronously.
+ *
+ * @param work Work that needs to be scheduled.
+ * @param workListener Work listener for callbacks.
+ * @return Work Work item representing the asynchronous work
+ */
+ public WorkItem schedule(Work work, WorkListener workListener) throws WorkRejectedException {
+
+ WorkItemImpl workItem = new WorkItemImpl(new UID().toString(), work);
+ if (workListener != null) {
+ workItems.put(workItem, workListener);
+ }
+ workAccepted(workItem, work);
+ if (scheduleWork(work, workItem)) {
+ return workItem;
+ } else {
+ workItem.setStatus(WorkEvent.WORK_REJECTED);
+ if (workListener != null) {
+ workListener.workRejected(new WorkEventImpl(workItem));
+ }
+ throw new WorkRejectedException("Unable to schedule work");
+ }
+ }
+
+ /**
+ * Wait for all the specified units of work to finish.
+ *
+ * @param works Units of the work that need to finish.
+ * @param timeout Timeout for waiting for the units of work to finish.
+ */
+ public boolean waitForAll(Collection works, long timeout) {
+ throw new UnsupportedOperationException("waitForAll not supported");
+ }
+
+ /**
+ * Wait for any of the specified units of work to finish.
+ *
+ * @param works Units of the work that need to finish.
+ * @param timeout Timeout for waiting for the units of work to finish.
+ */
+ public Collection waitForAny(Collection works, long timeout) {
+ throw new UnsupportedOperationException("waitForAny not supported");
+ }
+
+ /**
+ * Method provided for subclasses to indicate a work accptance.
+ *
+ * @param workItem Work item representing the work that was accepted.
+ * @param work Work that was accepted.
+ */
+ private void workAccepted(final WorkItemImpl workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_ACCEPTED);
+ WorkEvent event = new WorkEventImpl(workItem);
+ listener.workAccepted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work start.
+ */
+ private void workStarted(final WorkItemImpl workItem, final Work work) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_STARTED);
+ WorkEvent event = new WorkEventImpl(workItem);
+ listener.workStarted(event);
+ }
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final WorkItemImpl workItem, final Work work) {
+ workCompleted(workItem, work, null);
+ }
+
+ /*
+ * Method to indicate a work completion.
+ */
+ private void workCompleted(final WorkItemImpl workItem, final Work work, final WorkException exception) {
+ WorkListener listener = workItems.get(workItem);
+ if (listener != null) {
+ workItem.setStatus(WorkEvent.WORK_COMPLETED);
+ workItem.setResult(work);
+ workItem.setException(exception);
+ WorkEvent event = new WorkEventImpl(workItem);
+ listener.workCompleted(event);
+ workItems.remove(workItem);
+ }
+ }
+
+ /*
+ * Schedules the work using the threadpool.
+ */
+ private boolean scheduleWork(final Work work, final WorkItemImpl workItem) {
+ try {
+ executor.execute(new DecoratingWork(workItem, work));
+ return true;
+ } catch (RejectedExecutionException ex) {
+ return false;
+ }
+ }
+
+ /*
+ * Class that decorates the original worker so that it can get callbacks when work is done.
+ */
+ private final class DecoratingWork implements Runnable {
+
+ // Work item for this work.
+ private WorkItemImpl workItem;
+
+ // The original work.
+ private Work decoratedWork;
+
+ /*
+ * Initializes the work item and underlying work.
+ */
+ private DecoratingWork(final WorkItemImpl workItem, final Work decoratedWork) {
+ this.workItem = workItem;
+ this.decoratedWork = decoratedWork;
+ }
+
+ /*
+ * Overrides the run method.
+ */
+ public void run() {
+ workStarted(workItem, decoratedWork);
+ try {
+ decoratedWork.run();
+ workCompleted(workItem, decoratedWork);
+ } catch (Throwable th) {
+ workCompleted(workItem, decoratedWork, new WorkException(th.getMessage(), th));
+ }
+ }
+
+ }
+
+ @Destroy
+ public void destroy() {
+ executor.shutdown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.java
new file mode 100644
index 0000000000..62ebeea1fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEventImpl.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.sca.core.work;
+
+
+import commonj.work.WorkEvent;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * Default immutable implementation of the <code>WorkEvent</code> class.
+ */
+class WorkEventImpl implements WorkEvent {
+
+ // Work item for this event
+ private WorkItem workItem;
+
+ // Exception if something has gone wrong
+ private WorkException exception;
+
+ /**
+ * Instantiates the event.
+ *
+ * @param workItem Work item for this event.
+ */
+ public WorkEventImpl(final WorkItemImpl workItem) {
+ this.workItem = workItem;
+ this.exception = workItem.getException();
+ }
+
+ /**
+ * Returns the work type based on whether the work was accepted, started,
+ * rejected or completed.
+ *
+ * @return Work type.
+ */
+ public int getType() {
+ return workItem.getStatus();
+ }
+
+ /**
+ * Returns the work item associated with this work type.
+ *
+ * @return Work item.
+ */
+ public WorkItem getWorkItem() {
+ return workItem;
+ }
+
+ /**
+ * Returns the exception if the work completed with an exception.
+ *
+ * @return Work exception.
+ */
+ public WorkException getException() {
+ return exception;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.java
new file mode 100644
index 0000000000..fae3f1aae3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItemImpl.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.sca.core.work;
+
+import commonj.work.Work;
+import commonj.work.WorkException;
+import commonj.work.WorkItem;
+
+/**
+ * An identity based immutable implementation of the <code>WorkItem</code>
+ * interface.
+ *
+ */
+class WorkItemImpl implements WorkItem {
+
+ // Id scoped for the VM
+ private String id;
+
+ // Status
+ private int status = -1;
+
+ // Result
+ private Work result;
+
+ // Original work
+ private Work originalWork;
+
+ // Exception
+ private WorkException exception;
+
+ /**
+ * Instantiates an id for this item.
+ *
+ * @param id of this work event.
+ */
+ protected WorkItemImpl(final String id, final Work orginalWork) {
+ this.id = id;
+ this.originalWork = orginalWork;
+ }
+
+ /**
+ * Returns the id.
+ *
+ * @return Id of this item.
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the original work.
+ *
+ * @return Original work.
+ */
+ public Work getOriginalWork() {
+ return originalWork;
+ }
+
+ /**
+ * Returns the work result if the work completed.
+ *
+ * @return Work.
+ * @throws WorkException If the work completed with an exception.
+ */
+ public Work getResult() throws WorkException {
+ return result;
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param result Result.
+ */
+ protected void setResult(final Work result) {
+ this.result = result;
+ }
+
+ /**
+ * Returns the exception if work completed with an exception.
+ *
+ * @return Work exception.
+ */
+ protected WorkException getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the exception.
+ *
+ * @param exception Exception.
+ */
+ protected void setException(final WorkException exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * Returns the work type based on whether the work was accepted, started,
+ * rejected or completed.
+ *
+ * @return Work status.
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param status Status.
+ */
+ protected void setStatus(final int status) {
+ this.status = status;
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ return id.hashCode();
+ }
+
+ /**
+ * Indicates whether some other object is "equal to" this one.
+ *
+ * @param obj Object to be compared.
+ * @return true if this object is the same as the obj argument; false
+ * otherwise..
+ */
+ public boolean equals(final Object obj) {
+ return (obj != null) && (obj.getClass() == WorkItemImpl.class) && ((WorkItemImpl) obj).id.equals(id);
+ }
+
+ /**
+ * Compares this object with the specified object for order. Returns a
+ * negative integer, zero, or a positive integer as this object is less
+ * than, equal to, or greater than the specified object.
+ *
+ * @param o Object to be compared.
+ * @return A negative integer, zero, or a positive integer as this object
+ * is less than, equal to, or greater than the specified object.
+ * @throws ClassCastException needs better documentation.
+ */
+ public int compareTo(final Object o) {
+ if (o.getClass() != WorkItemImpl.class) {
+ throw new ClassCastException(o.getClass().getName());
+ } else {
+ return ((WorkItemImpl) o).getId().compareTo(getId());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectCreationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectCreationException.java
new file mode 100644
index 0000000000..3432c61c76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectCreationException.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.factory;
+
+
+/**
+ * Denotes an error creating a new object instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCreationException extends RuntimeException {
+ private static final long serialVersionUID = -6423113430265944499L;
+
+ public ObjectCreationException() {
+ super();
+ }
+
+ public ObjectCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCreationException(String message) {
+ super(message);
+ }
+
+ public ObjectCreationException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectFactory.java
new file mode 100644
index 0000000000..c5e0dad4e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/ObjectFactory.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.factory;
+
+/**
+ * Implementations create new instances of a particular type
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ObjectFactory<T> {
+
+ /**
+ * Return a instance of the type that this factory creates.
+ *
+ * @return a instance from this factory
+ */
+ T getInstance() throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/SingletonObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/SingletonObjectFactory.java
new file mode 100644
index 0000000000..074a1121c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/factory/SingletonObjectFactory.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.factory;
+
+
+/**
+ * Implementation of ObjectFactory that returns a single instance, typically an immutable type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactory<T> implements ObjectFactory<T> {
+ private final T instance;
+
+ public SingletonObjectFactory(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/AbstractLifecycle.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/AbstractLifecycle.java
new file mode 100644
index 0000000000..e5f88d91c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/AbstractLifecycle.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.scope;
+
+/**
+ * Base class providing a simple implementation of Lifecycle.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractLifecycle implements Lifecycle {
+ protected volatile int lifecycleState = UNINITIALIZED;
+
+ public int getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Set the current state of the Lifecycle.
+ *
+ * @param lifecycleState the new state
+ */
+ protected void setLifecycleState(int lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ public void start() {
+ setLifecycleState(RUNNING);
+ }
+
+ public void stop() {
+ setLifecycleState(STOPPED);
+ }
+
+ /**
+ * Returns the current lifecycle as a String (for example, "RUNNING").
+ *
+ * @return the current lifecycle as a String
+ */
+ public String toString() {
+ switch (lifecycleState) {
+ case Lifecycle.CONFIG_ERROR:
+ return "CONFIG_ERROR";
+ case Lifecycle.ERROR:
+ return "ERROR";
+ case Lifecycle.INITIALIZING:
+ return "INITIALIZING";
+ case Lifecycle.INITIALIZED:
+ return "INITIALIZED";
+ case Lifecycle.RUNNING:
+ return "RUNNING";
+ case Lifecycle.STOPPING:
+ return "STOPPING";
+ case Lifecycle.STOPPED:
+ return "STOPPED";
+ case Lifecycle.UNINITIALIZED:
+ return "UNINITIALIZED";
+ default:
+ return "UNKNOWN";
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/CoreRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/CoreRuntimeException.java
new file mode 100644
index 0000000000..ac3e51a982
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/CoreRuntimeException.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.scope;
+
+
+/**
+ * The root exception for the runtime package. Exceptions occurring in the runtime are generally non-recoverable
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class CoreRuntimeException extends RuntimeException {
+
+ public CoreRuntimeException() {
+ super();
+ }
+
+ public CoreRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CoreRuntimeException(String message) {
+ super(message);
+ }
+
+ public CoreRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/InstanceWrapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/InstanceWrapper.java
new file mode 100644
index 0000000000..a952e2e72b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/InstanceWrapper.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.scope;
+
+
+/**
+ * Provides lifecycle management for an implementation instance associated with
+ * a component for use by the component's associated {@link org.apache.tuscany.sca.scope.ScopeContainer}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InstanceWrapper<T> {
+
+ /**
+ * @return
+ */
+ T getInstance();
+
+ /**
+ * @throws TargetInitializationException
+ */
+ void start() throws TargetInitializationException;
+
+ /**
+ * @throws TargetDestructionException
+ */
+ void stop() throws TargetDestructionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Lifecycle.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Lifecycle.java
new file mode 100644
index 0000000000..02075cad01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Lifecycle.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.scope;
+
+/**
+ * Implementations adhere to runtime lifecycle semantics
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Lifecycle {
+ /* A configuration error state */
+ int CONFIG_ERROR = -1;
+ /* Has not been initialized */
+ int UNINITIALIZED = 0;
+ /* In the process of being configured and initialized */
+ int INITIALIZING = 1;
+ /* Instantiated and configured */
+ int INITIALIZED = 2;
+ /* Configured and initialized */
+ int RUNNING = 4;
+ /* In the process of being shutdown */
+ int STOPPING = 5;
+ /* Has been shutdown and removed from the composite */
+ int STOPPED = 6;
+ /* In an error state */
+ int ERROR = 7;
+
+ /**
+ * Returns the lifecycle state
+ *
+ * @see #UNINITIALIZED
+ * @see #INITIALIZING
+ * @see #INITIALIZED
+ * @see #RUNNING
+ * @see #STOPPING
+ * @see #STOPPED
+ */
+ int getLifecycleState();
+
+ /**
+ * Starts the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void start() throws CoreRuntimeException;
+
+ /**
+ * Stops the Lifecycle.
+ *
+ * @throws CoreRuntimeException
+ */
+ void stop() throws CoreRuntimeException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/PersistenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/PersistenceException.java
new file mode 100644
index 0000000000..54fba1ee03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/PersistenceException.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.scope;
+
+/**
+ * Raised when an error persisting a component implementation instance is encountered
+ *
+ * @version $Rev$ $Date$
+ */
+public class PersistenceException extends Exception {
+ private static final long serialVersionUID = -908468170919651248L;
+
+ public PersistenceException() {
+ }
+
+ public PersistenceException(String message) {
+ super(message);
+ }
+
+ public PersistenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public PersistenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Scope.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Scope.java
new file mode 100644
index 0000000000..9b3f208cb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/Scope.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.scope;
+
+/**
+ * The default implementation scopes supported by assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Scope {
+ public static final Scope STATELESS = new Scope("STATELESS");
+ public static final Scope REQUEST = new Scope("REQUEST");
+ public static final Scope SESSION = new Scope("SESSION");
+ public static final Scope CONVERSATION = new Scope("CONVERSATION");
+ public static final Scope COMPOSITE = new Scope("COMPOSITE");
+ public static final Scope SYSTEM = new Scope("SYSTEM");
+ public static final Scope UNDEFINED = new Scope("UNDEFINED");
+
+ private String scope;
+
+ public Scope(String scope) {
+ this.scope = scope.toUpperCase().intern();
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final Scope scope1 = (Scope) o;
+ return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
+ }
+
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainer.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainer.java
new file mode 100644
index 0000000000..30482fae90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainer.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.scope;
+
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * Manages the lifecycle and visibility of instances associated with a an {@link RuntimeComponent}.
+ *
+ * @version $Rev$ $Date$
+ * @param <KEY> the type of IDs that this container uses to identify its contexts.
+ * For example, for COMPOSITE scope this could be the URI of the composite component,
+ * or for HTTP Session scope it might be the HTTP session ID.
+ */
+public interface ScopeContainer<KEY> extends Lifecycle, RuntimeEventListener {
+
+ /**
+ * Returns the Scope that this container supports.
+ *
+ * @return the Scope that this container supports
+ */
+ Scope getScope();
+
+ /**
+ * Start a new context with the supplied ID.
+ *
+ * @param contextId an ID that uniquely identifies the context.
+ */
+ void startContext(KEY contextId);
+
+ /**
+ * Stop the context with the supplied ID.
+ *
+ * @param contextId an ID that uniquely identifies the context.
+ */
+ void stopContext(KEY contextId);
+
+ /**
+ * Returns an instance wrapper associated with the current scope context, creating one if necessary
+ * @param contextId the id for the scope context
+ *
+ * @return the wrapper for the target instance
+ * @throws TargetResolutionException if there was a problem instantiating the target instance
+ */
+ InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException;
+
+ /**
+ * Returns an implementation instance associated with the current scope context.
+ * If no instance is found, a {@link TargetNotFoundException} is thrown.
+ * @param contextId the id for the scope context
+ *
+ * @return the wrapper for the target instance
+ * @throws TargetResolutionException if there was a problem instantiating the target instance
+ */
+ InstanceWrapper getAssociatedWrapper(KEY contextId)
+ throws TargetResolutionException;
+
+ /**
+ * Return a wrapper after use (for example, after invoking the instance).
+ * @param wrapper the wrapper for the target instance being returned
+ * @param contextId the id for the scope context
+ *
+ * @throws TargetDestructionException if there was a problem returning the target instance
+ */
+ void returnWrapper(InstanceWrapper wrapper, KEY contextId)
+ throws TargetDestructionException;
+
+ /**
+ * Removes a component implementation instance associated with the current context from persistent storage
+ *
+ * @param component the owning component
+ * @throws PersistenceException if there was a problem removing the instance
+ */
+ void remove() throws PersistenceException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainerFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainerFactory.java
new file mode 100644
index 0000000000..b6acae7382
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeContainerFactory.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.sca.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Factory to create ScopeContainer for components
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopeContainerFactory {
+ ScopeContainer createScopeContainer(RuntimeComponent component);
+ Scope getScope();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeIdentifier.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeIdentifier.java
new file mode 100644
index 0000000000..77e7d76842
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeIdentifier.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.scope;
+
+/**
+ * Implementations enable lazy retrieval of a scope id associated with a request, i.e. an id (and presumably a context)
+ * do not have to be generated if the scope is never accessed. Identifiers are associated with the current request
+ * thread and keyed on scope type.
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.sca.factory.component.WorkContext
+ */
+public interface ScopeIdentifier {
+
+ /**
+ * Returns the scope id for the request.
+ */
+ Object getIdentifier();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeNotFoundException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeNotFoundException.java
new file mode 100644
index 0000000000..40a251c6f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeNotFoundException.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.scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeNotFoundException extends Exception {
+
+ private static final long serialVersionUID = -3447306764458851441L;
+
+ public ScopeNotFoundException(String scope) {
+ super("Scope not found: " + scope);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeRegistry.java
new file mode 100644
index 0000000000..f3319ee093
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopeRegistry.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * Manages {@link ScopeContainer}s in the runtime
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public interface ScopeRegistry {
+
+ /**
+ * Returns the scope container for the given scope or null if one not found
+ *
+ * @param scope the scope
+ * @return the scope container for the given scope or null if one not found
+ */
+ ScopeContainer getScopeContainer(RuntimeComponent component);
+
+ /**
+ * @param factory
+ */
+ void register(ScopeContainerFactory factory);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedImplementationProvider.java
new file mode 100644
index 0000000000..8b9c50b070
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedImplementationProvider.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.scope;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+
+/**
+ * A component implementation can implement this interface to provide scope
+ * management for the components
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopedImplementationProvider extends ImplementationProvider {
+ /**
+ * Get the scope for the component implementation
+ *
+ * @return The scope for the component implementation, if null is returned,
+ * STATELESS will be used
+ */
+ Scope getScope();
+
+ /**
+ * Indicate if the component needs to be eagerly initialized
+ *
+ * @return true if the component is marked to be eagerly initialized, false
+ * otherwise
+ */
+ boolean isEagerInit();
+
+ /**
+ * @return the maxAge
+ */
+ long getMaxAge();
+
+ /**
+ * @return the maxIdleTime
+ */
+ long getMaxIdleTime();
+
+ /**
+ * Create a wrapper for the component instance for the scope management
+ *
+ * @return A wrapper for the component instance
+ */
+ InstanceWrapper createInstanceWrapper();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedRuntimeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedRuntimeComponent.java
new file mode 100644
index 0000000000..6c33683bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/ScopedRuntimeComponent.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.scope;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Scoped runtime component
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ScopedRuntimeComponent extends RuntimeComponent {
+ /**
+ * Set the associated scope container
+ * @param scopeContainer
+ */
+ void setScopeContainer(ScopeContainer scopeContainer);
+ /**
+ * Get the assoicated scope container
+ * @return
+ */
+ ScopeContainer getScopeContainer();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetDestructionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetDestructionException.java
new file mode 100644
index 0000000000..6b251295f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetDestructionException.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.sca.scope;
+
+/**
+ * Denotes an error destroying a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetDestructionException extends TargetResolutionException {
+ private static final long serialVersionUID = -6126684147851674709L;
+
+ public TargetDestructionException() {
+ super();
+ }
+
+ public TargetDestructionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetDestructionException(String message) {
+ super(message);
+ }
+
+ public TargetDestructionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInitializationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInitializationException.java
new file mode 100644
index 0000000000..17cd21967f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInitializationException.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.sca.scope;
+
+/**
+ * Denotes an error initializing a target
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInitializationException extends TargetResolutionException {
+ private static final long serialVersionUID = -6228778208649752698L;
+
+ public TargetInitializationException() {
+ super();
+ }
+
+ public TargetInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInitializationException(String message) {
+ super(message);
+ }
+
+ public TargetInitializationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvocationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvocationException.java
new file mode 100644
index 0000000000..f9bfa0a788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvocationException.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.scope;
+
+/**
+ * Raised when an error is encountered during a target invocation
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetInvocationException extends Exception {
+
+ private static final long serialVersionUID = -6553427708442761743L;
+
+ public TargetInvocationException() {
+ super();
+ }
+
+ public TargetInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvocationException(String message) {
+ super(message);
+ }
+
+ public TargetInvocationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvokerCreationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvokerCreationException.java
new file mode 100644
index 0000000000..a20d030ee8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetInvokerCreationException.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.sca.scope;
+
+/**
+ * Denotes an error creating a target invoker
+ *
+ * @version $Rev$ $Date$
+ * @Deprecated
+ */
+public abstract class TargetInvokerCreationException extends Exception {
+
+ public TargetInvokerCreationException() {
+ super();
+ }
+
+ public TargetInvokerCreationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetInvokerCreationException(String message) {
+ super(message);
+ }
+
+ public TargetInvokerCreationException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetNotFoundException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetNotFoundException.java
new file mode 100644
index 0000000000..4dd63f58f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetNotFoundException.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.sca.scope;
+
+/**
+ * Thrown when a target of an operation cannot be found
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class TargetNotFoundException extends TargetResolutionException {
+ private static final long serialVersionUID = 5541830480658471186L;
+
+ public TargetNotFoundException() {
+ super();
+ }
+
+ public TargetNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetNotFoundException(String message) {
+ super(message);
+ }
+
+ public TargetNotFoundException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetResolutionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetResolutionException.java
new file mode 100644
index 0000000000..284ab8b6c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/main/java/org/apache/tuscany/sca/scope/TargetResolutionException.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.sca.scope;
+
+/**
+ * Denotes an error retrieving a target instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetResolutionException extends Exception {
+ private static final long serialVersionUID = 2912513650522019405L;
+
+ public TargetResolutionException() {
+ super();
+ }
+
+ public TargetResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TargetResolutionException(String message) {
+ super(message);
+ }
+
+ public TargetResolutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java
new file mode 100644
index 0000000000..40a146e129
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.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.core;
+
+import junit.framework.TestCase;
+
+public class DefaultExtensionPointRegistryTestCase extends TestCase {
+ private ExtensionPointRegistry registry;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultExtensionPointRegistry();
+ }
+
+ public void testRegistry() {
+ MyRegistry service = new MyREgistryImpl();
+ registry.addExtensionPoint(service);
+ assertSame(service, registry.getExtensionPoint(MyRegistry.class));
+ registry.removeExtensionPoint(service);
+ assertNull(registry.getExtensionPoint(MyRegistry.class));
+ }
+
+ private static interface MyRegistry {
+ void doSomething();
+ }
+
+ private static class MyREgistryImpl implements MyRegistry {
+
+ public void doSomething() {
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
new file mode 100644
index 0000000000..d2050523eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.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.core.event;
+
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.event.Event;
+import org.apache.tuscany.sca.event.EventFilter;
+import org.apache.tuscany.sca.event.EventPublisher;
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.event.TrueFilter;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BaseEventPublisherTestCase extends TestCase {
+ EventPublisher publisher;
+
+ public void testFireListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ publisher.addListener(listener);
+ publisher.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testRemoveListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ publisher.addListener(listener);
+ publisher.removeListener(listener);
+ publisher.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testFalseFilterListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ EasyMock.replay(listener);
+ publisher.addListener(new FalseFilter(), listener);
+ publisher.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ public void testTrueFilterListener() {
+ Event event = new TestEvent();
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.same(event));
+ EasyMock.expectLastCall();
+ EasyMock.replay(listener);
+ publisher.addListener(new TrueFilter(), listener);
+ publisher.publish(event);
+ EasyMock.verify(listener);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ publisher = new BaseEventPublisher() {
+ };
+ }
+
+ private class TestEvent implements Event {
+ public Object getSource() {
+ return null;
+ }
+ }
+
+ private class FalseFilter implements EventFilter {
+
+ public boolean match(Event event) {
+ return false;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
new file mode 100644
index 0000000000..bf95d640c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.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.core.event;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EventTestCase extends TestCase {
+ private URI uri = URI.create("foo");
+
+ public void testCompositeStart() {
+ ComponentStart event = new ComponentStart(this, uri);
+ assertEquals(uri, event.getComponentURI());
+ }
+
+ public void testCompositeStop() {
+ ComponentStop event = new ComponentStop(this, uri);
+ assertEquals(uri, event.getComponentURI());
+ }
+
+ public void testHttpSessionStart() {
+ Object id = new Object();
+ HttpSessionStart event = new HttpSessionStart(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getSessionID());
+ }
+
+ public void testHttpSessionEnd() {
+ Object id = new Object();
+ HttpSessionEnd event = new HttpSessionEnd(this, id);
+ assertEquals(this, event.getSource());
+ assertEquals(id, event.getSessionID());
+ }
+
+ public void testRequestStart() {
+ RequestStart event = new RequestStart(this);
+ assertEquals(this, event.getSource());
+ }
+
+ public void testReequestEnd() {
+ RequestEnd event = new RequestEnd(this);
+ assertEquals(this, event.getSource());
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/AsyncTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/AsyncTarget.java
new file mode 100644
index 0000000000..c30e19de88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/AsyncTarget.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.core.mock.component;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AsyncTarget {
+ @OneWay
+ void invoke();
+
+ int getCount();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadContextPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadContextPojo.java
new file mode 100644
index 0000000000..f9ae94f152
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadContextPojo.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.core.mock.component;
+
+import org.osoa.sca.annotations.Context;
+
+public class BadContextPojo {
+
+ @Context
+ String context;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadNamePojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadNamePojo.java
new file mode 100644
index 0000000000..c4074484b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BadNamePojo.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.core.mock.component;
+
+import org.osoa.sca.annotations.ComponentName;
+
+public class BadNamePojo {
+ @ComponentName
+ private int name;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterface.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterface.java
new file mode 100644
index 0000000000..ca305b9ef0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterface.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.core.mock.component;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface BasicInterface {
+ String returnsProperty();
+
+ BasicInterface returnsReference();
+
+ int returnsInt();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterfaceImpl.java
new file mode 100644
index 0000000000..ea32d1f6b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/BasicInterfaceImpl.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.sca.core.mock.component;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicInterfaceImpl implements BasicInterface {
+
+ @Property
+ public String publicProperty;
+
+ @Reference (required = false)
+ public BasicInterface publicReference;
+
+ @Property
+ protected String protectedProperty;
+
+ @Reference (required = false)
+ protected BasicInterface protectedReference;
+
+ private String privateProperty;
+
+ private BasicInterface privateReference;
+
+ @Property
+ public void setPrivateProperty(String privateProperty) {
+ this.privateProperty = privateProperty;
+ }
+
+ @Reference (required = false)
+ public void setPrivateReference(BasicInterface privateReference) {
+ this.privateReference = privateReference;
+ }
+
+ public String returnsProperty() {
+ return privateProperty;
+ }
+
+ public BasicInterface returnsReference() {
+ return privateReference;
+ }
+
+ public int returnsInt() {
+ return 0;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponent.java
new file mode 100644
index 0000000000..6d320df145
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public interface CompositeScopeComponent {
+
+ //public boolean isInit();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponentImpl.java
new file mode 100644
index 0000000000..9ff289a502
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeComponentImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class CompositeScopeComponentImpl implements
+ CompositeScopeComponent {
+
+ private String foo;
+
+ public void setFoo(String foo) {
+ this.foo = foo;
+ }
+
+ public String getFoo() {
+ return foo;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..832055a084
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeDestroyOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeDestroyOnlyComponent extends CompositeScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..e8b76e13c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitDestroyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeInitDestroyComponent extends CompositeScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ if (destroyed) {
+ throw new AssertionError("Destroy called more than once");
+ }
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..057580be7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/CompositeScopeInitOnlyComponent.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.sca.core.mock.component;
+
+import org.osoa.sca.annotations.Init;
+
+public class CompositeScopeInitOnlyComponent extends CompositeScopeComponentImpl {
+
+ private boolean initialized;
+ // this value tests to ensure introspection can find the init() method even
+ // if a field is named the same. Ultimately, this should be in the introspection tests
+ private boolean init;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ if (initialized) {
+ throw new AssertionError("Init called more than once");
+ }
+ initialized = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponent.java
new file mode 100644
index 0000000000..79f48a57c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public interface ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponentImpl.java
new file mode 100644
index 0000000000..5b42d92191
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeComponentImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public class ConversationalScopeComponentImpl implements ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..c64556e754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeDestroyOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeDestroyOnlyComponent extends ConversationalScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..6f930ef750
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitDestroyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitDestroyComponent
+ extends ConversationalScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..70733f4d99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/ConversationalScopeInitOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitOnlyComponent
+ extends ConversationalScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderException.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderException.java
new file mode 100644
index 0000000000..4bb9cde958
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderException.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.core.mock.component;
+
+public class OrderException extends Exception {
+
+ public OrderException() {
+ super();
+ }
+
+ public OrderException(String message) {
+ super(message);
+ }
+
+ public OrderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OrderException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojo.java
new file mode 100644
index 0000000000..df59029884
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojo.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.core.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedDependentPojo extends OrderedInitPojo {
+
+ OrderedInitPojo getPojo();
+
+ void setPojo(OrderedInitPojo pojo);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojoImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojoImpl.java
new file mode 100644
index 0000000000..1b51c2772d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedDependentPojoImpl.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.core.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class OrderedDependentPojoImpl extends OrderedInitPojoImpl implements OrderedDependentPojo {
+
+ private OrderedInitPojo pojo;
+
+ public OrderedInitPojo getPojo() {
+ return pojo;
+ }
+
+ public void setPojo(OrderedInitPojo pojo) {
+ this.pojo = pojo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedEagerInitPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedEagerInitPojo.java
new file mode 100644
index 0000000000..139086bf0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedEagerInitPojo.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+@EagerInit
+public class OrderedEagerInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojo.java
new file mode 100644
index 0000000000..1c3615fcd0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojo.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.core.mock.component;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedInitPojo {
+ int getNumberInstantiated();
+
+ int getInitOrder();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojoImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojoImpl.java
new file mode 100644
index 0000000000..b65ead9b19
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OrderedInitPojoImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class OrderedInitPojoImpl implements OrderedInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ public OrderedInitPojoImpl() {
+ }
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTarget.java
new file mode 100644
index 0000000000..963c31a4ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTarget.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.core.mock.component;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface OtherTarget {
+
+ String getString();
+
+ void setString(String val);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTargetImpl.java
new file mode 100644
index 0000000000..91ccc9e772
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/OtherTargetImpl.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.core.mock.component;
+
+/**
+ * A target used for testing wires with a different source and target interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class OtherTargetImpl implements OtherTarget {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeComponent.java
new file mode 100644
index 0000000000..7d03c4372d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("REQUEST")
+public interface RequestScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..f94f071086
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeDestroyOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..f2de2d9afa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitDestroyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..9bcef40834
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/RequestScopeInitOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponent.java
new file mode 100644
index 0000000000..8318333feb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public interface SessionScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponentImpl.java
new file mode 100644
index 0000000000..0494d587aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeComponentImpl.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public class SessionScopeComponentImpl implements
+ SessionScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..fdc11a80af
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitDestroyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..4e849895f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SessionScopeInitOnlyComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Init;
+
+public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTarget.java
new file mode 100644
index 0000000000..44eb94260e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTarget.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.core.mock.component;
+
+public interface SimpleTarget {
+
+ String hello(String message) throws Exception;
+
+ String goodbye(String message) throws Exception;
+
+ String echo(String message) throws Exception;
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTargetImpl.java
new file mode 100644
index 0000000000..662b21116a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SimpleTargetImpl.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.sca.core.mock.component;
+
+public class SimpleTargetImpl implements SimpleTarget {
+
+ public SimpleTargetImpl() {
+ super();
+ }
+
+ public String hello(String message) throws Exception {
+ return message;
+ }
+
+ public String goodbye(String message) throws Exception {
+ return message;
+ }
+
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Source.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Source.java
new file mode 100644
index 0000000000..aa3b5be528
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Source.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.core.mock.component;
+
+import java.util.List;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Source {
+
+ Target getTarget();
+
+ List<Target> getTargets();
+
+ List<Target> getTargetsThroughField();
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SourceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SourceImpl.java
new file mode 100644
index 0000000000..81e39a9fe9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/SourceImpl.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.core.mock.component;
+
+import java.util.List;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class SourceImpl implements Source {
+
+ private Target target;
+ private List<Target> targets;
+ private List<Target> targetsThroughField;
+ private Target[] targetsArray;
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public List<Target> getTargets() {
+ return targets;
+ }
+
+ public void setTargets(List<Target> targets) {
+ this.targets = targets;
+ }
+
+ public List<Target> getTargetsThroughField() {
+ return targetsThroughField;
+ }
+
+ public Target[] getArrayOfTargets() {
+ return targetsArray;
+ }
+
+ public void setArrayOfTargets(Target[] targets) {
+ targetsArray = targets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponent.java
new file mode 100644
index 0000000000..89d0be7a53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponent.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.core.mock.component;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("STATELESS")
+public interface StatelessComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponentImpl.java
new file mode 100644
index 0000000000..28eb28e76d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/StatelessComponentImpl.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.core.mock.component;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessComponentImpl implements
+ StatelessComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Target.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Target.java
new file mode 100644
index 0000000000..5e85ed48b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/Target.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.sca.core.mock.component;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Target {
+
+ String getString();
+
+ void setString(String val);
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/TargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/TargetImpl.java
new file mode 100644
index 0000000000..169b38a8d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/mock/component/TargetImpl.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.core.mock.component;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetImpl implements Target {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java
new file mode 100644
index 0000000000..5be8fe21b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.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.core.scope;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopedImplementationProvider;
+import org.easymock.EasyMock;
+import org.easymock.IMocksControl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractScopeContainerTestCase<T, KEY> extends TestCase {
+ protected IMocksControl control;
+ protected ScopeContainer<KEY> scopeContainer;
+ protected URI groupId;
+ protected KEY contextId;
+ protected RuntimeComponent component;
+ protected ScopedImplementation implementation;
+ protected InstanceWrapper<T> wrapper;
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ control = EasyMock.createStrictControl();
+ component = control.createMock(RuntimeComponent.class);
+ wrapper = control.createMock(InstanceWrapper.class);
+ implementation = control.createMock(ScopedImplementation.class);
+ EasyMock.expect(component.getImplementation()).andReturn(implementation).anyTimes();
+ }
+
+ protected void preRegisterComponent() throws Exception {
+ scopeContainer.start();
+ EasyMock.expect(implementation.isEagerInit()).andStubReturn(false);
+ }
+
+ protected void expectCreateWrapper() throws Exception {
+ EasyMock.expect(implementation.createInstanceWrapper()).andReturn(wrapper);
+ wrapper.start();
+ }
+
+ protected static interface ScopedImplementation extends ScopedImplementationProvider, Implementation {
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
new file mode 100644
index 0000000000..2f5c182f45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.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.sca.core.store;
+
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.event.RuntimeEventListener;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.store.DuplicateRecordException;
+import org.apache.tuscany.sca.store.Store;
+import org.apache.tuscany.sca.store.StoreExpirationEvent;
+import org.apache.tuscany.sca.store.StoreMonitor;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MemoryStoreTestCase extends TestCase {
+ private StoreMonitor monitor;
+
+ public void testEviction() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, 1);
+ Thread.sleep(200);
+ assertNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testNotifyOnEviction() throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
+ listener.onEvent(EasyMock.isA(StoreExpirationEvent.class));
+ EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ latch.countDown();
+ return null;
+ }
+ });
+ EasyMock.replay(listener);
+ MemoryStore store = new MemoryStore(monitor);
+ store.addListener(listener);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, 1);
+ if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
+ // failed to notify listener
+ fail();
+ }
+ EasyMock.verify(listener);
+ }
+
+ public void testNoEviction() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ Thread.sleep(100);
+ assertNotNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testInsertRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.destroy();
+ }
+
+ public void testInsertAlreadyExists() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createMock(RuntimeComponent.class);
+ EasyMock.expect(component.getURI()).andReturn("component");
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ store.insertRecord(component, id, value, Store.NEVER);
+ try {
+ store.insertRecord(component, id, value, Store.NEVER);
+ fail();
+ } catch (DuplicateRecordException e) {
+ //expected
+ }
+ store.destroy();
+ }
+
+ public void testUpdateRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+ Object newValue = new Object();
+
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.updateRecord(component, id, newValue, 1L);
+ assertEquals(newValue, store.readRecord(component, id));
+ store.destroy();
+ }
+
+ public void testDeleteRecord() throws Exception {
+ MemoryStore store = new MemoryStore(monitor);
+ store.setReaperInterval(10);
+ store.init();
+ RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
+ EasyMock.replay(component);
+ String id = UUID.randomUUID().toString();
+ Object value = new Object();
+
+ store.insertRecord(component, id, value, Store.NEVER);
+ store.removeRecord(component, id);
+ assertNull(store.readRecord(component, id));
+ store.destroy();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ monitor = EasyMock.createNiceMock(StoreMonitor.class);
+ EasyMock.replay(monitor);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
new file mode 100644
index 0000000000..58503fd852
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.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.core.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.easymock.EasyMock;
+import org.osoa.sca.NoRegisteredCallbackException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackInterfaceInterceptorTestCase extends TestCase {
+
+ public void testImplements() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(true);
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
+ EasyMock.replay(next);
+ interceptor.setNext(next);
+ interceptor.invoke(new MessageFactoryImpl().createMessage());
+ EasyMock.verify(next);
+ }
+
+ public void testDoesNotImplement() {
+ CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor(false);
+ try {
+ interceptor.invoke(new MessageFactoryImpl().createMessage());
+ fail();
+ } catch (NoRegisteredCallbackException e) {
+ // expected
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
new file mode 100644
index 0000000000..83f7bdd887
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.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.sca.core.wire;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InvocationChainImplTestCase extends TestCase {
+
+ public void testInsertAtEnd() throws Exception {
+ InvocationChain chain = new InvocationChainImpl(new OperationImpl("foo"));
+ Interceptor inter2 = new MockInterceptor();
+ Interceptor inter1 = new MockInterceptor();
+ chain.addInterceptor(inter1);
+ chain.addInterceptor(inter2);
+ Interceptor head = (Interceptor)chain.getHeadInvoker();
+ assertEquals(inter1, head);
+ assertEquals(inter2, head.getNext());
+ assertEquals(inter2, chain.getTailInvoker());
+
+ }
+
+ private class MockInterceptor implements Interceptor {
+
+ private Invoker next;
+
+ public Message invoke(Message msg) {
+ return null;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
new file mode 100644
index 0000000000..c5f93edeb6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.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.core.wire;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.getCurrentArguments;
+import static org.easymock.EasyMock.isA;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.easymock.EasyMock;
+import org.easymock.IAnswer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NonBlockingInterceptorTestCase extends TestCase {
+
+ public void testInvoke() throws Exception {
+ WorkScheduler scheduler = createMock(WorkScheduler.class);
+ scheduler.scheduleWork(isA(Runnable.class));
+ expectLastCall().andStubAnswer(new IAnswer<Object>() {
+ public Object answer() throws Throwable {
+ Runnable runnable = (Runnable) getCurrentArguments()[0];
+ runnable.run();
+ return null;
+ }
+ });
+ replay(scheduler);
+ Message context = createMock(Message.class);
+ String convID = "convID";
+ EasyMock.expect(context.getConversationID()).andReturn(convID);
+ EasyMock.replay(context);
+ ThreadMessageContext.setMessageContext(context);
+ Message msg = createMock(Message.class);
+ msg.setCorrelationID(null);
+ msg.setConversationID(convID);
+ Interceptor next = EasyMock.createMock(Interceptor.class);
+ EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
+ EasyMock.replay(next);
+ EasyMock.replay(msg);
+ Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);
+ interceptor.invoke(msg);
+ verify(context);
+ verify(next);
+ verify(msg);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/AssertionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/AssertionTestCase.java
new file mode 100644
index 0000000000..77d0e01dc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/AssertionTestCase.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.factory;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AssertionTestCase extends TestCase {
+ /**
+ * test case that confirms that JRE assertions are enabled
+ */
+ public void testAssertionsAreEnabled() {
+ try {
+ assert false;
+ fail("assertions are not enabled");
+ } catch (AssertionError e) {
+ // ok
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/SingletonObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/SingletonObjectFactoryTestCase.java
new file mode 100644
index 0000000000..4d38c447ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/factory/SingletonObjectFactoryTestCase.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.factory;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactoryTestCase extends TestCase {
+
+ public void testSingleton() throws Exception {
+ Object o = new Object();
+ SingletonObjectFactory<Object> factory = new SingletonObjectFactory<Object>(o);
+ assertEquals(o, factory.getInstance());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java
new file mode 100644
index 0000000000..1b95c6ff63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.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.scope;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.scope.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeTestCase extends TestCase {
+
+ public void testEquals() throws Exception {
+ Scope scope = new Scope("COMPOSITE");
+ assertTrue(scope.equals(Scope.COMPOSITE));
+ }
+
+ public void testEqualsNew() throws Exception {
+ Scope foo = new Scope("foo");
+ Scope foo2 = new Scope("FOO");
+ assertTrue(foo.equals(foo2));
+ }
+
+ public void testNotEquals() throws Exception {
+ Scope foo = new Scope("BAR");
+ Scope foo2 = new Scope("FOO");
+ assertFalse(foo.equals(foo2));
+ }
+
+ public void testNotEqualsDifferent() throws Exception {
+ Scope foo = new Scope("FOO");
+ assertFalse(foo.equals(new Bar("FOO")));
+ }
+
+ public class Bar {
+ String scope;
+
+ public Bar(String scope) {
+ this.scope = scope;
+ }
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/.ruleset
new file mode 100644
index 0000000000..27b9ab847c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/.ruleset
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/pom.xml
new file mode 100755
index 0000000000..923778d29f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-axiom</artifactId>
+ <name>Apache Tuscany Data Binding for Axiom</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java
new file mode 100644
index 0000000000..72fc90d187
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.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.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for AXIOM
+ */
+public class AxiomDataBinding extends BaseDataBinding {
+
+ public static final String NAME = OMElement.class.getName();
+ public static final String[] ALIASES = new String[] {"axiom"};
+
+ public AxiomDataBinding() {
+ super(NAME, ALIASES, OMElement.class);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseDataBinding#getWrapperHandler()
+ */
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new OMElementWrapperHandler();
+ }
+
+ public Object copy(Object source) {
+ if ( OMElement.class.isAssignableFrom(source.getClass()) ) {
+ try {
+ OMElement sourceElement = (OMElement)source;
+ return sourceElement.cloneOMElement();
+ } catch ( Exception e ) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ return super.copy(source);
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new AxiomExceptionHandler();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.java
new file mode 100644
index 0000000000..dd4553fc6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandler.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.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * AXIOM implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomExceptionHandler implements ExceptionHandler {
+
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ return new FaultException(message, (OMElement)faultInfo, cause);
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ FaultException faultException = (FaultException)exception;
+ return faultException.getFaultInfo();
+
+ }
+
+ public DataType<?> getFaultType(DataType exceptionType) {
+ if (FaultException.class == exceptionType.getPhysical()) {
+ XMLType type = XMLType.UNKNOWN;
+ if(exceptionType.getLogical() instanceof XMLType) {
+ type = (XMLType) exceptionType.getLogical();
+ }
+ DataType<XMLType> faultType = new DataTypeImpl<XMLType>(AxiomDataBinding.NAME, OMElement.class, type);
+ return faultType;
+ } else {
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
new file mode 100644
index 0000000000..28141cd144
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.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.databinding.axiom;
+
+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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Helper for AXIOM
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomHelper {
+
+ private AxiomHelper() {
+ }
+
+ /**
+ * @param context
+ * @param element
+ */
+ public static void adjustElementName(TransformationContext context, OMElement element) {
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (!(logical instanceof XMLType)) {
+ return;
+ }
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
+ // TODO: Throw expection or switch to the new Element
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ QName name = xmlType.getElementName();
+ OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(name.getLocalPart());
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
new file mode 100644
index 0000000000..4d2bc2b4d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.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.databinding.axiom;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
+
+/**
+ * Transformer to convert data from a simple java bject to OMElement
+ */
+public class OMElement2Object extends SimpleType2JavaTransformer<OMElement> {
+
+ @Override
+ protected String getText(OMElement source) {
+ return source.getText();
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
new file mode 100755
index 0000000000..3eb5878de3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.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 org.apache.tuscany.sca.databinding.axiom;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * Transformer to convert data from an OMElement to XML String
+ */
+public class OMElement2String extends BaseTransformer<OMElement, String> implements PullTransformer<OMElement, String> {
+ // private XmlOptions options;
+
+ public String transform(OMElement source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ source.serialize(writer);
+ return writer.toString();
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java
new file mode 100755
index 0000000000..c72bee62e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.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.databinding.axiom;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class OMElement2XMLStreamReader extends BaseTransformer<OMElement, XMLStreamReader> implements PullTransformer<OMElement, XMLStreamReader> {
+ // private XmlOptions options;
+
+ public XMLStreamReader transform(OMElement source, TransformationContext context) {
+ return source.getXMLStreamReader();
+ }
+
+ public Class getSourceType() {
+ return OMElement.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
new file mode 100644
index 0000000000..91d00c4c79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.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.databinding.axiom;
+
+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.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+
+/**
+ * OMElement wrapper handler implementation
+ */
+public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
+
+ private OMFactory factory;
+
+ public OMElementWrapperHandler() {
+ super();
+ this.factory = OMAbstractFactory.getOMFactory();
+ }
+
+ public OMElement create(ElementInfo element, TransformationContext context) {
+ OMElement wrapper = factory.createOMElement(element.getQName(), null);
+ return wrapper;
+ }
+
+ public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) {
+ OMElement element = (OMElement)value;
+ QName elementName = childElement.getQName();
+ OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
+ element.setNamespace(namespace);
+ element.setLocalName(childElement.getQName().getLocalPart());
+ wrapper.addChild((OMElement)value);
+ }
+
+ public List getChildren(OMElement wrapper) {
+ List<Object> elements = new ArrayList<Object>();
+ for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
+ elements.add(i.next());
+ }
+ return elements;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java
new file mode 100644
index 0000000000..50ac0ecae6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.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.databinding.axiom;
+
+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.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
+
+/**
+ * Transformer to convert data from an simple OMElement to Java Object
+ */
+public class Object2OMElement extends Java2SimpleTypeTransformer<OMElement> {
+
+ private OMFactory factory;
+
+ public Object2OMElement() {
+ super();
+ factory = OMAbstractFactory.getOMFactory();
+ }
+
+ protected OMElement createElement(QName element, String text, TransformationContext context) {
+ OMElement omElement = factory.createOMElement(element, null);
+ factory.createOMText(omElement, text);
+ return omElement;
+ }
+
+ @Override
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
new file mode 100755
index 0000000000..b2549029f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.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.databinding.axiom;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class String2OMElement extends BaseTransformer<String, OMElement> implements
+ PullTransformer<String, OMElement> {
+
+ @SuppressWarnings("unchecked")
+ public OMElement transform(String source, TransformationContext context) {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes()));
+ OMElement element = builder.getDocumentElement();
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
new file mode 100755
index 0000000000..ffb31aae0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.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.databinding.axiom;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2OMElement extends BaseTransformer<XMLStreamReader, OMElement> implements
+ PullTransformer<XMLStreamReader, OMElement> {
+
+ public XMLStreamReader2OMElement() {
+ super();
+ }
+
+ public OMElement transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ StAXOMBuilder builder = new StAXOMBuilder(source);
+ OMElement element = builder.getDocumentElement();
+ AxiomHelper.adjustElementName(context, element);
+ return element;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.java
new file mode 100644
index 0000000000..8dd3cb0f51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/module/AxiomDataBindingModuleActivator.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.databinding.axiom.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.axiom.AxiomDataBinding;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2Object;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2String;
+import org.apache.tuscany.sca.databinding.axiom.OMElement2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.axiom.Object2OMElement;
+import org.apache.tuscany.sca.databinding.axiom.String2OMElement;
+import org.apache.tuscany.sca.databinding.axiom.XMLStreamReader2OMElement;
+
+/**
+ * Module activator for AXIOM databinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class AxiomDataBindingModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ dataBindings.addDataBinding(new AxiomDataBinding());
+
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ transformers.addTransformer(new Object2OMElement());
+ transformers.addTransformer(new OMElement2Object());
+ transformers.addTransformer(new OMElement2String());
+ transformers.addTransformer(new OMElement2XMLStreamReader());
+ transformers.addTransformer(new String2OMElement());
+ transformers.addTransformer(new XMLStreamReader2OMElement());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..394d11304d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.databinding.axiom.module.AxiomDataBindingModuleActivator \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..d75d729294
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/AxiomExceptionHandlerTestCase.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.sca.databinding.axiom;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Test case for SDOExceptionHandler
+ */
+public class AxiomExceptionHandlerTestCase 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 AxiomExceptionHandler handler;
+ private OMElement faultElement;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new AxiomExceptionHandler();
+ XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
+ StAXOMBuilder builder = new StAXOMBuilder(reader);
+ faultElement = builder.getDocumentElement();
+ }
+
+ public void testGetFaultType() {
+ DataType<?> dataType = handler.getFaultType(new DataTypeImpl<XMLType>(FaultException.class, null));
+ assertEquals(OMElement.class, dataType.getPhysical());
+ assertEquals(XMLType.UNKNOWN, dataType.getLogical());
+ assertEquals(AxiomDataBinding.NAME, dataType.getDataBinding());
+ dataType = handler.getFaultType(new DataTypeImpl<XMLType>(Exception.class, null));
+ assertNull(dataType);
+ }
+
+ public void testCreate() {
+
+ Exception ex = handler.createException(null, "Order", faultElement, null);
+ assertTrue(ex instanceof FaultException);
+ FaultException exception = (FaultException)ex;
+ assertEquals("Order", exception.getMessage());
+ assertSame(faultElement, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ FaultException exception = new FaultException("Order", faultElement, null);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(faultElement, faultInfo);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
new file mode 100755
index 0000000000..7c04a98859
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.axiom;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMElement;
+
+public class OMElementTestCase 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 final void testStringTransform() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+ OMElement2String t2 = new OMElement2String();
+ String xml = t2.transform(element, null);
+ Assert.assertNotNull(xml);
+ Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
+ }
+
+ public final void testStringTransform2() {
+ String str =
+ "<p0:firstName xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:p0=\"http://helloworld\">Robert</p0:firstName>";
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(str, null);
+ OMElement2String t2 = new OMElement2String();
+ String xml = t2.transform(element, null);
+ Assert.assertNotNull(xml);
+ Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
+ }
+
+ public final void testStAXTransform() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+
+ OMElement2XMLStreamReader t2 = new OMElement2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(element, null);
+
+ XMLStreamReader2OMElement t3 = new XMLStreamReader2OMElement();
+ OMElement element2 = t3.transform(reader, null);
+
+ Assert.assertEquals(element2.getQName(), element.getQName());
+ Assert.assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), element2.getQName());
+ }
+
+ public final void testCopy() {
+ String2OMElement t1 = new String2OMElement();
+ OMElement element = t1.transform(IPO_XML, null);
+ OMElement copy = (OMElement)new AxiomDataBinding().copy(element);
+ assertNotSame(element, copy);
+ assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getQName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xml
new file mode 100755
index 0000000000..df901d183d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xml
@@ -0,0 +1,51 @@
+<?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.
+-->
+<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>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..af1e73172d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/ipo.xsd
@@ -0,0 +1,137 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/order.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/order.wsdl
new file mode 100644
index 0000000000..a5ead60382
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-axiom/src/test/resources/order.wsdl
@@ -0,0 +1,76 @@
+<?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="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
+ xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
+ <element name="checkOrderStatus">
+ <complexType>
+ <sequence>
+ <element name="customerId" type="string" />
+ <element name="order" type="ipo:PurchaseOrderType" />
+ <element name="flag" type="int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="checkOrderStatusResponse">
+ <complexType>
+ <sequence>
+ <element name="status" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="note" type="string" />
+ </schema>
+ </types>
+
+ <message name="CheckOrderStatusInput1">
+ <part name="body" element="xsd1:checkOrderStatus" />
+ </message>
+
+ <message name="CheckOrderStatusOutput1">
+ <part name="body" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <message name="CheckOrderStatusInput2">
+ <part name="p1" element="xsd1:checkOrderStatus" />
+ <part name="p2" element="xsd1:note" />
+ </message>
+
+ <message name="CheckOrderStatusOutput2">
+ <part name="p1" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <portType name="OrderPortType">
+ <operation name="checkOrderStatus">
+ <input message="tns:CheckOrderStatusInput1" />
+ <output message="tns:CheckOrderStatusOutput1" />
+ </operation>
+ <operation name="checkOrderStatus2">
+ <input message="tns:CheckOrderStatusInput2" />
+ <output message="tns:CheckOrderStatusOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/.ruleset
new file mode 100644
index 0000000000..27b9ab847c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/.ruleset
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/pom.xml
new file mode 100755
index 0000000000..aebff2bd7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/pom.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-jaxb</artifactId>
+ <name>Apache Tuscany Data Binding for JAXB</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.ws</groupId>
+ <artifactId>jaxws-api</artifactId>
+ <!-- Set to 2.1 to make jaxws-maven-plugin happy -->
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.5</version>
+ <scope>runtime</scope>
+ <!-- Replacing stax 1.0 with stax 1.0.1 -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jsr173_api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/nonav/repository</url>
+ <layout>legacy</layout>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <id>java.net</id>
+ <name>java.net Maven 1.x Repository</name>
+ <url>https://maven-repository.dev.java.net/repository</url>
+ <layout>legacy</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <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/jaxb-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>com.sun.tools.xjc.maven2</groupId>
+ <artifactId>maven-jaxb-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>generate-jaxb</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <generatePackage>com.example.ipo.jaxb</generatePackage>
+ <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
+ <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
+ <includeSchemas>
+ <includeSchema>ipo.xsd</includeSchema>
+ </includeSchemas>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java
new file mode 100755
index 0000000000..c1d3c36076
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.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.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+public class JAXB2Node extends BaseTransformer<Object, Node> implements PullTransformer<Object, Node> {
+
+ public Node transform(Object source, TransformationContext tContext) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
+ Marshaller marshaller = context.createMarshaller();
+ // FIXME: The default Marshaller doesn't support
+ // marshaller.getNode()
+ Document document = DOMHelper.newDocument();
+ JAXBElement<?> jaxbElement = JAXBContextHelper.createJAXBElement(tContext.getSourceDataType(), source);
+ marshaller.marshal(jaxbElement, document);
+ return document;
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
new file mode 100644
index 0000000000..93a7a5da0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.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.databinding.jaxb;
+
+import java.beans.Introspector;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+public class JAXBContextHelper {
+ // TODO: Do we need to set them for source and target?
+ public static final String JAXB_CLASSES = "jaxb.classes";
+
+ public static final String JAXB_CONTEXT_PATH = "jaxb.contextPath";
+
+ private JAXBContextHelper() {
+ }
+
+ public static JAXBContext createJAXBContext(TransformationContext tContext, boolean source) throws JAXBException {
+ if (tContext == null)
+ throw new TransformationException("JAXB context is not set for the transformation.");
+
+ DataType<?> bindingContext = source ? tContext.getSourceDataType() : tContext.getTargetDataType();
+ // FIXME: We should check the context path or classes
+ // FIXME: What should we do if JAXB is an intermediate node?
+
+ String contextPath = null;
+ JAXBContext context = null;
+ Class cls = bindingContext.getPhysical();
+ if (cls.getPackage() != null) {
+ contextPath = cls.getPackage().getName();
+ context = JAXBContext.newInstance(contextPath);
+ }
+ if (context == null) {
+ throw new TransformationException("JAXB context is not set for the transformation.");
+ }
+ return context;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static JAXBElement createJAXBElement(DataType dataType, Object value) {
+ if (value instanceof JAXBElement) {
+ return (JAXBElement)value;
+ } else {
+ Class type = (Class)dataType.getPhysical();
+ Object logical = dataType.getLogical();
+ QName elementName = JAXBDataBinding.ROOT_ELEMENT;
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ } else {
+ /**
+ * Set the declared type to Object.class so that xsi:type
+ * will be produced
+ */
+ type = Object.class;
+ }
+ } else {
+ type = Object.class;
+ }
+ return new JAXBElement(elementName, type, value);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Object createReturnValue(DataType dataType, Object value) {
+ Class<?> cls = getJavaType(dataType);
+ if (cls == JAXBElement.class) {
+ return createJAXBElement(dataType, value);
+ } else {
+ if (value instanceof JAXBElement) {
+ return ((JAXBElement)value).getValue();
+ } else {
+ return value;
+ }
+ }
+ }
+
+ public static Class<?> getJavaType(DataType<?> dataType) {
+ if (dataType == null) {
+ return null;
+ }
+ Type type = dataType.getPhysical();
+ if (type instanceof Class) {
+ Class cls = (Class)type;
+ if (JAXBElement.class.isAssignableFrom(cls)) {
+ return null;
+ } else {
+ return cls;
+ }
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ return (Class)pType.getRawType();
+ }
+ return null;
+ }
+
+ public static XMLType getXmlTypeName(Class<?> javaType) {
+ String namespace = null;
+ String name = null;
+ Package pkg = javaType.getPackage();
+ if (pkg != null) {
+ XmlSchema schema = pkg.getAnnotation(XmlSchema.class);
+ if (schema != null) {
+ namespace = schema.namespace();
+ }
+ }
+ XmlType type = javaType.getAnnotation(XmlType.class);
+ if (type != null) {
+ String typeNamespace = type.namespace();
+ String typeName = type.name();
+
+ if (typeNamespace.equals("##default") && typeName.equals("")) {
+ XmlRootElement rootElement = javaType.getAnnotation(XmlRootElement.class);
+ if (rootElement != null) {
+ namespace = rootElement.namespace();
+ } else {
+ // FIXME: The namespace should be from the referencing
+ // property
+ namespace = null;
+ }
+ } else if (typeNamespace.equals("##default")) {
+ // namespace is from the package
+ } else {
+ namespace = typeNamespace;
+ }
+
+ if (typeName.equals("##default")) {
+ name = Introspector.decapitalize(javaType.getSimpleName());
+ } else {
+ name = typeName;
+ }
+ } else {
+ XmlEnum xmlEnum = javaType.getAnnotation(XmlEnum.class);
+ if (xmlEnum != null) {
+ name = Introspector.decapitalize(javaType.getSimpleName());
+ }
+ }
+ if (name == null) {
+ return null;
+ }
+ return new XMLType(null, new QName(namespace, name));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java
new file mode 100644
index 0000000000..9706ffdc21
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.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.sca.databinding.jaxb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+
+/**
+ * JAXB DataBinding
+ */
+public class JAXBDataBinding extends BaseDataBinding {
+ public static final String NAME = JAXBElement.class.getName();
+ public static final String[] ALIASES = new String[] {"jaxb"};
+
+ public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/jaxb/1.0";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
+
+ public JAXBDataBinding() {
+ super(NAME, ALIASES, JAXBElement.class);
+ }
+
+ @Override
+ public boolean introspect(DataType dataType, Annotation[] annotations) {
+ Object physical = dataType.getPhysical();
+ if (!(physical instanceof Class)) {
+ return false;
+ }
+ Class javaType = (Class)physical;
+ if (JAXBElement.class.isAssignableFrom(javaType)) {
+ Type type = javaType.getGenericSuperclass();
+ if (type instanceof ParameterizedType) {
+ ParameterizedType parameterizedType = ((ParameterizedType)type);
+ Type rawType = parameterizedType.getRawType();
+ if (rawType == JAXBElement.class) {
+ Type actualType = parameterizedType.getActualTypeArguments()[0];
+ if (actualType instanceof Class) {
+ XMLType xmlType = JAXBContextHelper.getXmlTypeName((Class)actualType);
+ dataType.setLogical(xmlType);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+ }
+ }
+ dataType.setLogical(XMLType.UNKNOWN);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+
+ XMLType xmlType = JAXBContextHelper.getXmlTypeName(javaType);
+ if (xmlType == null) {
+ return false;
+ }
+ dataType.setLogical(xmlType);
+ dataType.setDataBinding(getName());
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object copy(Object arg) {
+ try {
+ boolean isElement = false;
+ Class cls = arg.getClass();
+ if (arg instanceof JAXBElement) {
+ isElement = true;
+ cls = ((JAXBElement)arg).getDeclaredType();
+ } else {
+ arg = new JAXBElement(ROOT_ELEMENT, Object.class, arg);
+ }
+ JAXBContext context = JAXBContext.newInstance(cls);
+ Document doc = DOMHelper.newDocument();
+ context.createMarshaller().marshal(arg, doc);
+ JAXBElement<?> element = context.createUnmarshaller().unmarshal(doc, cls);
+ return isElement ? element : element.getValue();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new JAXBExceptionHandler();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBExceptionHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBExceptionHandler.java
new file mode 100644
index 0000000000..c2ca78e018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBExceptionHandler.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.sca.databinding.jaxb;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
+
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * JAXB implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXBExceptionHandler implements ExceptionHandler {
+ private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+
+ /**
+ * <ul>
+ * <li>WrapperException(String message, FaultBean faultInfo) <br>
+ * A constructor where WrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean.
+ * <li> WrapperException(String message, FaultBean faultInfo, Throwable
+ * cause) <br>
+ * A constructor whereWrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean. The last argument, cause, may be used to convey
+ * protocol specific fault information
+ * </ul>
+ */
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ Class exceptionClass = (Class)exceptionType.getPhysical();
+ DataType<?> faultBeanType = exceptionType.getLogical();
+ Class faultBeanClass = (Class)faultBeanType.getPhysical();
+ try {
+ Constructor constructor =
+ exceptionClass.getConstructor(new Class[] {String.class, faultBeanClass, Throwable.class});
+ return (Exception)constructor.newInstance(new Object[] {message, faultInfo, cause});
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ try {
+ Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ return method.invoke(exception, (Object[])null);
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public DataType<?> getFaultType(DataType exDataType) {
+ Class<?> exceptionType = (Class) exDataType.getPhysical();
+ WebFault webFault = exceptionType.getAnnotation(WebFault.class);
+ if (webFault == null) {
+ return null;
+ } else {
+ QName element = new QName(webFault.targetNamespace(), webFault.name());
+ // TODO: Need to determine the fault bean class
+ // String faultBean = webFault.faultBean();
+ Class faultBeanClass = null;
+ try {
+ Method method = exceptionType.getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ faultBeanClass = method.getReturnType();
+ } catch (NoSuchMethodException e) {
+ faultBeanClass = null;
+ }
+ // The logical type of a fault is the QName of the element that the
+ // only part in
+ // the fault message references
+ DataType<XMLType> faultType =
+ new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, faultBeanClass, new XMLType(element, null));
+ // faultType.setMetadata(ElementInfo.class.getName(), new
+ // ElementInfo(element, null));
+ return faultType;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java
new file mode 100644
index 0000000000..528d6fd703
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.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.sca.databinding.jaxb;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+
+/**
+ * JAXB WrapperHandler implementation
+ */
+public class JAXBWrapperHandler implements WrapperHandler<JAXBElement<?>> {
+
+ public JAXBElement<?> create(ElementInfo element, TransformationContext context) {
+ try {
+ // FIXME: How do we map the global element to a factory?
+ String packageName = null;
+ String factoryClassName = packageName + ".ObjectFactory";
+ ClassLoader classLoader = context != null ? context.getClassLoader() : null;
+ if (classLoader == null) {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ Class<?> factoryClass = Class.forName(factoryClassName, true, classLoader);
+ assert factoryClass.isAnnotationPresent(XmlRegistry.class);
+ Object factory = factoryClass.newInstance();
+ QName elementName = element.getQName();
+ Method method = null;
+ for (Method m : factoryClass.getMethods()) {
+ XmlElementDecl xmlElement = m.getAnnotation(XmlElementDecl.class);
+ QName name = new QName(xmlElement.namespace(), xmlElement.name());
+ if (xmlElement != null && name.equals(elementName)) {
+ method = m;
+ break;
+ }
+ }
+ if (method != null) {
+ Class typeClass = method.getParameterTypes()[0];
+ Object value = typeClass.newInstance();
+ return (JAXBElement<?>)method.invoke(factory, new Object[] {value});
+ } else {
+ throw new TransformationException("ObjectFactory cannot be resolved.");
+ }
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public void setChild(JAXBElement<?> wrapper, int i, ElementInfo childElement, Object value) {
+ Object wrapperValue = wrapper.getValue();
+ Class<?> wrapperClass = wrapperValue.getClass();
+
+ XmlType xmlType = wrapperClass.getAnnotation(XmlType.class);
+ String[] properties = xmlType.propOrder();
+ String property = properties[i];
+
+ try {
+ for (Method m : wrapperClass.getMethods()) {
+ if (m.getName().equals("set" + capitalize(property))) {
+ m.invoke(wrapperValue, new Object[] {value});
+ return;
+ }
+ }
+ } catch (Throwable e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ private static String capitalize(String name) {
+ char first = Character.toUpperCase(name.charAt(0));
+ return first + name.substring(1);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#getChildren(java.lang.Object)
+ */
+ public List getChildren(JAXBElement<?> wrapper) {
+ Object wrapperValue = wrapper.getValue();
+ Class<?> wrapperClass = wrapperValue.getClass();
+
+ XmlType xmlType = wrapperClass.getAnnotation(XmlType.class);
+ String[] properties = xmlType.propOrder();
+ List<Object> elements = new ArrayList<Object>();
+ for (String p : properties) {
+ try {
+ Method method = wrapperClass.getMethod("get" + capitalize(p), (Class[])null);
+ Object value = method.invoke(wrapperValue, (Object[])null);
+ elements.add(value);
+ } catch (Throwable e) {
+ throw new TransformationException(e);
+ }
+ }
+ return elements;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXWSJavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXWSJavaInterfaceProcessor.java
new file mode 100644
index 0000000000..60ed6f2f81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXWSJavaInterfaceProcessor.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.sca.databinding.jaxb;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * The databinding annotation processor for java interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
+
+ public JAXWSJavaInterfaceProcessor() {
+ super();
+ }
+
+ public void visitInterface(JavaInterface contract) throws InvalidInterfaceException {
+ if (!contract.isRemotable()) {
+ return;
+ }
+ Class<?> clazz = contract.getJavaClass();
+ Map<String, Operation> operations = new HashMap<String, Operation>();
+ for (Operation op : contract.getOperations()) {
+ operations.put(op.getName(), op);
+ }
+ for (Method method : clazz.getMethods()) {
+ Operation operation = operations.get(method.getName());
+
+ WebMethod webMethod = method.getAnnotation(WebMethod.class);
+ if (webMethod == null) {
+ return;
+ }
+
+ String operationName = getValue(webMethod.operationName(), operation.getName());
+
+ RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class);
+ ResponseWrapper responseWrapper = method.getAnnotation(ResponseWrapper.class);
+ if (requestWrapper == null) {
+ return;
+ }
+
+ WebService webService = clazz.getAnnotation(WebService.class);
+ String tns = "";
+ if (webService != null) {
+ tns = webService.targetNamespace();
+ }
+
+ String ns = getValue(requestWrapper.targetNamespace(), tns);
+ String name = getValue(requestWrapper.localName(), operationName);
+ QName inputWrapper = new QName(ns, name);
+
+ ns = getValue(responseWrapper.targetNamespace(), tns);
+ name = getValue(responseWrapper.localName(), operationName + "Response");
+
+ QName outputWrapper = new QName(ns, name);
+
+ WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, new ElementInfo(inputWrapper, null),
+ new ElementInfo(outputWrapper, null), null, null);
+ operation.setWrapperStyle(true);
+ operation.setWrapper(wrapperInfo);
+ }
+ }
+
+ private static String getValue(String value, String defaultValue) {
+ return "".equals(value) ? defaultValue : value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
new file mode 100755
index 0000000000..31beb344f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.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.sca.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node, Object> {
+
+ public Node2JAXB() {
+ super();
+ }
+
+ public Object transform(Node source, TransformationContext context) {
+ if (source == null)
+ return null;
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Object result = unmarshaller.unmarshal(source);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java
new file mode 100644
index 0000000000..e0bb0e189c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.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.sca.databinding.jaxb;
+
+import java.io.Reader;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class Reader2JAXB extends BaseTransformer<Reader, Object> implements
+ PullTransformer<Reader, Object> {
+
+ public Object transform(final Reader source, final TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ StreamSource streamSource = new StreamSource(source);
+ Object result = unmarshaller.unmarshal(streamSource);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java
new file mode 100755
index 0000000000..061f488a01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.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.sca.databinding.jaxb;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2JAXB extends BaseTransformer<XMLStreamReader, Object> implements
+ PullTransformer<XMLStreamReader, Object> {
+
+ public XMLStreamReader2JAXB() {
+ super();
+ }
+
+ public Object transform(XMLStreamReader source, TransformationContext context) {
+ if (source == null) {
+ return null;
+ }
+ try {
+ JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ Object result = unmarshaller.unmarshal(source);
+ return JAXBContextHelper.createReturnValue(context.getTargetDataType(), result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return JAXBDataBinding.NAME;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/module/JAXBDataBindingModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/module/JAXBDataBindingModuleActivator.java
new file mode 100644
index 0000000000..3e98bf652d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/module/JAXBDataBindingModuleActivator.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.databinding.jaxb.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.databinding.jaxb.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+
+/**
+ * Module activator for JAXB databinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class JAXBDataBindingModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ dataBindings.addDataBinding(new JAXBDataBinding());
+
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ transformers.addTransformer(new JAXB2Node());
+ transformers.addTransformer(new Node2JAXB());
+ transformers.addTransformer(new Reader2JAXB());
+ transformers.addTransformer(new XMLStreamReader2JAXB());
+
+ JavaInterfaceIntrospectorExtensionPoint introspectors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ introspectors.addInterfaceVisitor(new JAXWSJavaInterfaceProcessor());
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..2998cf93e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.databinding.jaxb.module.JAXBDataBindingModuleActivator \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.java
new file mode 100644
index 0000000000..aa191c20b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBDataBindingTestCase.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.databinding.jaxb;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+import com.example.ipo.jaxb.USAddress;
+import com.example.ipo.jaxb.USState;
+
+/**
+ *
+ */
+public class JAXBDataBindingTestCase extends TestCase {
+ private JAXBDataBinding binding;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new JAXBDataBinding();
+ }
+
+ /**
+ * Test method for
+ * {@link org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Annotation)}.
+ */
+ public final void testIntrospect() {
+ DataType dataType = new DataTypeImpl<Class>(JAXBElement.class, null);
+ boolean yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertTrue(dataType.getPhysical() == JAXBElement.class && dataType.getLogical() == XMLType.UNKNOWN);
+ dataType = new DataTypeImpl<Class>(MockJAXBElement.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(MockJAXBElement.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataTypeImpl<Class>(USAddress.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(USAddress.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataTypeImpl<Class>(USState.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertEquals(USState.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USState"), ((XMLType)dataType.getLogical()).getTypeName());
+
+ }
+
+ private static class MockJAXBElement extends JAXBElement<PurchaseOrderType> {
+
+ private static final long serialVersionUID = -2767569071002707973L;
+
+ /**
+ * @param elementName
+ * @param type
+ * @param value
+ */
+ public MockJAXBElement(QName elementName, Class<PurchaseOrderType> type, PurchaseOrderType value) {
+ super(elementName, type, value);
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopy() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> po = factory.createPurchaseOrder(poType);
+ JAXBElement<PurchaseOrderType> copy = (JAXBElement<PurchaseOrderType>)binding.copy(po);
+ assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getName());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonElement() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType poType = factory.createPurchaseOrderType();
+ poType.setComment("Comment");
+ PurchaseOrderType copy = (PurchaseOrderType)binding.copy(poType);
+ assertTrue(copy instanceof PurchaseOrderType);
+ assertEquals("Comment", ((PurchaseOrderType)copy).getComment());
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testCopyNonRoot() {
+ ObjectFactory factory = new ObjectFactory();
+ USAddress address = factory.createUSAddress();
+ address.setCity("San Jose");
+ USAddress copy = (USAddress)binding.copy(address);
+ assertTrue(copy instanceof USAddress);
+ assertEquals("San Jose", ((USAddress)copy).getCity());
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..5b85f9096d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBExceptionHandlerTestCase.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.databinding.jaxb;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault;
+import org.apache.tuscany.databinding.jaxb.fault.InvalidSymbolFault_Exception;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBExceptionHandlerTestCase extends TestCase {
+ private static final QName ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
+ private JAXBExceptionHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBExceptionHandler();
+ }
+
+ public void testGetFaultType() {
+ DataType exType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> dataType = handler.getFaultType(exType);
+ assertEquals(InvalidSymbolFault.class, dataType.getPhysical());
+ assertEquals(ELEMENT, ((XMLType) dataType.getLogical()).getElementName());
+ assertEquals(JAXBDataBinding.NAME, dataType.getDataBinding());
+ }
+
+ public void testCreate() {
+ DataType execType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> faultType = handler.getFaultType(execType);
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ DataType<DataType> exType = new DataTypeImpl<DataType>(InvalidSymbolFault_Exception.class, faultType);
+ Exception ex = handler.createException(exType, "Invalid symbol", fault, null);
+ assertTrue(ex instanceof InvalidSymbolFault_Exception);
+ InvalidSymbolFault_Exception exception = (InvalidSymbolFault_Exception)ex;
+ assertEquals("Invalid symbol", exception.getMessage());
+ assertSame(fault, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ InvalidSymbolFault fault = new InvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ InvalidSymbolFault_Exception exception = new InvalidSymbolFault_Exception("Invalid symbol", fault);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(fault, faultInfo);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.java
new file mode 100755
index 0000000000..f1caf42fcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBTestCase.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.databinding.jaxb;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.io.StringReader;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
+import org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;
+import org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Node;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+public class JAXBTestCase 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 String contextPath = "com.example.ipo.jaxb";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransform() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ DataType targetDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform2() throws Exception {
+ Reader2JAXB t0 = new Reader2JAXB();
+
+ QName root = new QName("http://www.example.com/IPO", "purchaseOrder");
+ DataType targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ // targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext = createMock(TransformationContext.class);
+ expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
+ replay(tContext);
+
+ Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
+
+ DataType sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
+ // sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ Node node = t1.transform(object1, tContext1);
+
+ Assert.assertNotNull(node);
+
+ Node2JAXB t2 = new Node2JAXB();
+ Object object2 = t2.transform(node, tContext);
+ Assert.assertNotNull(object2);
+
+ }
+
+ public void testTransform3() throws Exception {
+
+ DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+
+ TransformationContext tContext1 = createMock(TransformationContext.class);
+ expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
+ replay(tContext1);
+
+ JAXB2Node t1 = new JAXB2Node();
+ PurchaseOrderType po = new ObjectFactory().createPurchaseOrderType();
+ Node node = t1.transform(po, tContext1);
+
+ Assert.assertNotNull(node);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..355acd619c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/JAXBWrapperHandlerTestCase.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.databinding.jaxb;
+
+import java.util.List;
+
+import javax.xml.bind.JAXBElement;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHandler;
+
+import com.example.ipo.jaxb.ObjectFactory;
+import com.example.ipo.jaxb.PurchaseOrderType;
+
+/**
+ * Test case for JAXBExceptionHandler
+ */
+public class JAXBWrapperHandlerTestCase extends TestCase {
+ // private static final QName ELEMENT = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private JAXBWrapperHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new JAXBWrapperHandler();
+ }
+
+ public void testCreate() {
+ // ElementInfo element = new ElementInfo(ELEMENT, null);
+ // JAXBElement<?> jaxbElement = handler.create(element, null);
+ }
+
+ public void testSetChild() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ handler.setChild(wrapper, 2, null, "Comment");
+ }
+
+ public void testGetChildren() {
+ ObjectFactory factory = new ObjectFactory();
+ PurchaseOrderType po = factory.createPurchaseOrderType();
+ po.setComment("Comment");
+ JAXBElement<PurchaseOrderType> wrapper = factory.createPurchaseOrder(po);
+ List children = handler.getChildren(wrapper);
+ assertNotNull(children);
+ assertEquals(4, children.size());
+ assertEquals("Comment", children.get(2));
+ assertNull(children.get(0));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.java
new file mode 100644
index 0000000000..fd21d72337
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault.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.databinding.jaxb.fault;
+
+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;
+
+/**
+ * <p>
+ * Java class for anonymous complex type.
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {"message", "symbol"})
+@XmlRootElement(name = "InvalidSymbolFault")
+public class InvalidSymbolFault {
+
+ @XmlElement(required = true)
+ protected String message;
+ @XmlElement(required = true)
+ protected String symbol;
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+ /**
+ * Gets the value of the symbol property.
+ *
+ * @return possible object is {@link String }
+ */
+ public String getSymbol() {
+ return symbol;
+ }
+
+ /**
+ * Sets the value of the symbol property.
+ *
+ * @param value allowed object is {@link String }
+ */
+ public void setSymbol(String value) {
+ this.symbol = value;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.java
new file mode 100644
index 0000000000..19ce1dca23
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/java/org/apache/tuscany/databinding/jaxb/fault/InvalidSymbolFault_Exception.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.jaxb.fault;
+
+import javax.xml.ws.WebFault;
+
+/**
+ * This class was generated by the JAXWS SI. JAX-WS RI 2.1-02/02/2007 09:55
+ * AM(vivekp)-FCS Generated source version: 2.1
+ */
+@WebFault(name = "InvalidSymbolFault", targetNamespace = "http://www.example.com/stock")
+public class InvalidSymbolFault_Exception extends Exception {
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @param faultInfo
+ * @param message
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..241ec15d36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-jaxb/src/test/resources/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.checkstyle
new file mode 100644
index 0000000000..c7b30ffd5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.checkstyle
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.ruleset
new file mode 100644
index 0000000000..27b9ab847c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/.ruleset
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/pom.xml
new file mode 100644
index 0000000000..ea9ad42d54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-sdo-axiom</artifactId>
+ <name>Apache Tuscany Data Binding for SDO/AXIOM</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.4</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.4</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-po-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
+ <javaPackage>com.example.ipo.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-stock-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ <prefix>Stock</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java
new file mode 100644
index 0000000000..4060fd8e5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.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.databinding.sdo2om;
+
+import static org.apache.tuscany.sca.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
+
+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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * SDO DataObject --> AXIOM OMElement transformer
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataObject2OMElement extends BaseTransformer<DataObject, OMElement> implements
+ PullTransformer<DataObject, OMElement> {
+
+ public OMElement transform(DataObject source, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ OMNamespace namespace = null;
+ String localName = ROOT_ELEMENT.getLocalPart();
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object logical = dataType == null ? null : dataType.getLogical();
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ if (xmlType.isElement()) {
+ namespace = factory.createOMNamespace(xmlType.getElementName().getNamespaceURI(), xmlType
+ .getElementName().getPrefix());
+ localName = xmlType.getElementName().getLocalPart();
+ }
+ }
+ }
+ if (namespace == null) {
+ namespace = factory.createOMNamespace(ROOT_ELEMENT.getNamespaceURI(), ROOT_ELEMENT.getPrefix());
+ }
+
+ XMLDocument document = helperContext.getXMLHelper().createDocument(source,
+ namespace.getNamespaceURI(),
+ localName);
+ SDODataSource dataSource = new SDODataSource(document, helperContext);
+ OMElement element = factory.createOMElement(dataSource, localName, namespace);
+ return element;
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObjectSerializer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObjectSerializer.java
new file mode 100644
index 0000000000..4301ba09e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObjectSerializer.java
@@ -0,0 +1,427 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.sdo2om;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sdo.impl.AttributeImpl;
+import org.apache.tuscany.sdo.impl.ReferenceImpl;
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XSDHelper;
+
+public class DataObjectSerializer {
+ private static final String ELEMENT_TEXT = "Text Element";
+
+ // static final String ELEMENT_TEXT = "Element Text";
+ private static final QName XSI_TYPE_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "type", "xsi");
+
+ private Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
+
+ private NameSpaceContextImpl namespaceContext = new NameSpaceContextImpl();
+
+ private DataObject rootDataObject;
+
+ private String rootElementName;
+
+ private String rootElementURI;
+
+ private XMLStreamWriter xmlWriter;
+
+ private XSDHelper xsdHelper;
+
+ public DataObjectSerializer(DataObject rootObject,
+ XMLStreamWriter xmlWriter,
+ HelperContext helperCtx,
+ TransformationContext context) {
+ this.xmlWriter = xmlWriter;
+ this.rootDataObject = rootObject;
+ this.xsdHelper = helperCtx.getXSDHelper();
+ this.rootElementName = xsdHelper.getLocalName(rootObject.getType());
+ this.rootElementURI = rootDataObject.getType().getURI();
+
+ if (context != null) {
+ DataType dataType = context.getTargetDataType();
+ Object targetQName = dataType == null ? null : dataType.getLogical();
+ if (targetQName instanceof QName) {
+ QName name = (QName)targetQName;
+ this.rootElementName = name.getLocalPart();
+ this.rootElementURI = name.getNamespaceURI();
+ }
+ }
+
+ }
+
+ // 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);
+ // }
+ // }
+
+ public DataObjectSerializer(XMLDocument sourceDocument, XMLStreamWriter xmlWriter, HelperContext helperCtx) {
+ this.xmlWriter = xmlWriter;
+ this.rootDataObject = sourceDocument.getRootObject();
+ this.rootElementName = sourceDocument.getRootElementName();
+ this.rootElementURI = sourceDocument.getRootElementURI();
+ this.xsdHelper = helperCtx.getXSDHelper();
+ }
+
+ protected class NameSpaceContextImpl implements NamespaceContext {
+ private int counter;
+
+ private Map<String, String> prefixToNamespaceMapping = new HashMap<String, String>();
+
+ public NameSpaceContextImpl() {
+ prefixToNamespaceMapping.put("xml", "http://www.w3.org/XML/1998/namespace");
+ prefixToNamespaceMapping.put("xmlns", "http://www.w3.org/2000/xmlns/");
+ prefixToNamespaceMapping.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
+ }
+
+ public synchronized QName createQName(String nsURI, String name) {
+ String prefix = nsURI != null ? (String)getPrefix(nsURI) : null;
+ if (prefix == null && nsURI != null && !nsURI.equals("")) {
+ prefix = "p" + (counter++);
+ }
+ if (prefix == null) {
+ prefix = "";
+ }
+ if (nsURI != null) {
+ prefixToNamespaceMapping.put(prefix, nsURI);
+ declaredNamespaceMap.put(prefix, nsURI);
+ }
+ return new QName(nsURI, name, prefix);
+ }
+
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null) {
+ throw new IllegalArgumentException("Prefix is null");
+ }
+
+ String ns = (String)prefixToNamespaceMapping.get(prefix);
+ if (ns != null) {
+ return ns;
+ } else {
+ return null;
+ }
+ }
+
+ public String getPrefix(String nsURI) {
+ if (nsURI == null) {
+ throw new IllegalArgumentException("Namespace is null");
+ }
+ for (Iterator i = prefixToNamespaceMapping.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry)i.next();
+ if (entry.getValue().equals(nsURI)) {
+ return (String)entry.getKey();
+ }
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(String nsURI) {
+ List prefixList = new ArrayList();
+ for (Iterator i = prefixToNamespaceMapping.entrySet().iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry)i.next();
+ if (entry.getValue().equals(nsURI)) {
+ prefixList.add(entry.getKey());
+ }
+ }
+ return prefixList.iterator();
+ }
+
+ public void registerMapping(String prefix, String nsURI) {
+ prefixToNamespaceMapping.put(prefix, nsURI);
+ }
+
+ public void removeMapping(String prefix) {
+ prefixToNamespaceMapping.remove(prefix);
+ }
+ }
+
+ protected static class NameValuePair implements Map.Entry {
+ private Object key;
+
+ private Object value;
+
+ public NameValuePair(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public Object getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ Object v = this.value;
+ this.value = value;
+ return v;
+ }
+
+ }
+
+ private static boolean isTransient(Property property, Object type) {
+ // HACK: We need some SDOUtil extension to understand a property is
+ // derived
+ EStructuralFeature feature = (EStructuralFeature)property;
+ if (ExtendedMetaData.INSTANCE.getGroup(feature) != null) {
+ return false;
+ }
+ feature = ExtendedMetaData.INSTANCE.getAffiliation((EClass)type, feature);
+ if (feature != null && feature != property) {
+ return false;
+ }
+ if (property instanceof ReferenceImpl) {
+ ReferenceImpl r = (ReferenceImpl)property;
+ if (r.isTransient()) {
+ return true;
+ }
+ EReference opposite = r.getEOpposite();
+ if (opposite != null && opposite.isContainment()) {
+ return true;
+ }
+ } else if (property instanceof AttributeImpl) {
+ AttributeImpl a = (AttributeImpl)property;
+ if (a.isTransient()) {
+ return true;
+ }
+ EDataType d = (EDataType)a.getEType();
+ if (!d.isSerializable()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addListValue(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ List objList) throws XMLStreamException {
+ if (objList != null) {
+ for (int j = 0; j < objList.size(); j++) {
+ Object object = objList.get(j);
+ addSingleValue(propertyList, children, property, object);
+ }
+ }
+ }
+
+ private void addProperty(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ Object value,
+ DataObject dataObject) throws XMLStreamException {
+
+ if (property.isMany() && property.getContainingType().isOpen() && value instanceof Sequence) {
+ addSequenceValue(propertyList, children, (Sequence)value);
+ } else if (SDOUtil.isMany(property, dataObject) && value instanceof List) {
+ addListValue(propertyList, children, property, (List)value);
+ } else {
+ // Complex Type
+ addSingleValue(propertyList, children, property, value);
+ }
+ }
+
+ private void addSequenceValue(List<NameValuePair> elements, List<DataObject> children, Sequence seq)
+ throws XMLStreamException {
+ if (seq != null && seq.size() > 0) {
+ for (int j = 0; j < seq.size(); j++) {
+ Object o = seq.getValue(j);
+ Property p = seq.getProperty(j);
+ addSingleValue(elements, children, p, o);
+ }
+ }
+ }
+
+ private void addSingleValue(List<NameValuePair> propertyList,
+ List<DataObject> children,
+ Property property,
+ Object value) throws XMLStreamException {
+ String uri = xsdHelper.getNamespaceURI(property);
+ String name = xsdHelper.getLocalName(property);
+ QName qname = namespaceContext.createQName(uri, name);
+ Type propertyType = property.getType();
+
+ if (property.getName().equals("value") && uri == null && name.equals(":0")) {
+ propertyList.add(new NameValuePair(ELEMENT_TEXT, value.toString()));
+ } else if (value == null) {
+ NameValuePair entry = new NameValuePair(qname, null);
+ propertyList.add(entry);
+ } else if (propertyType.isDataType()) {
+ NameValuePair entry = new NameValuePair(qname, SDOUtil.convertToString(propertyType, value));
+ propertyList.add(entry);
+ } else {
+ children.add((DataObject)value);
+ }
+ }
+
+ private void registerNamespace(String prefix, String uri) {
+ if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
+ namespaceContext.registerMapping(prefix, uri);
+ declaredNamespaceMap.put(prefix, uri);
+ }
+ }
+
+ public void serialize() throws XMLStreamException {
+ xmlWriter.setNamespaceContext(namespaceContext);
+ writeDataObject(rootDataObject, rootElementName, rootElementURI);
+ xmlWriter.flush();
+ }
+
+ private void writeDataObject(DataObject obj, String elementName, String elementURI) throws XMLStreamException {
+ List<NameValuePair> elementList = new ArrayList<NameValuePair>();
+ List<DataObject> children = new ArrayList<DataObject>();
+ List<NameValuePair> attributes = new ArrayList<NameValuePair>();
+
+ String typeName;
+ QName realTypeName = null;
+
+ if (elementName != null) {
+ realTypeName = namespaceContext.createQName(elementURI, elementName);
+ String typeQName = realTypeName.getPrefix() + ":" + realTypeName.getLocalPart();
+ declaredNamespaceMap.put(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+ attributes.add(new NameValuePair(XSI_TYPE_QNAME, typeQName));
+ registerNamespace(XSI_TYPE_QNAME.getPrefix(), XSI_TYPE_QNAME.getNamespaceURI());
+ } else {
+
+ typeName = xsdHelper.getLocalName(obj.getContainmentProperty());
+ realTypeName = namespaceContext.createQName(obj.getType().getURI(), typeName);
+ registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+ }
+
+ registerNamespace(realTypeName.getPrefix(), realTypeName.getNamespaceURI());
+
+ if (obj.getType().isSequenced()) {
+ Sequence sequence = obj.getSequence();
+ for (int i = 0; i < sequence.size(); i++) {
+ Property property = sequence.getProperty(i);
+ Object value = sequence.getValue(i);
+ if (property == null) {
+ elementList.add(new NameValuePair(ELEMENT_TEXT, value));
+ } else {
+ addProperty(elementList, children, property, value, obj);
+ }
+ }
+
+ // Attributes are not in the sequence
+ List properties = obj.getInstanceProperties();
+ for (Iterator i = properties.iterator(); i.hasNext();) {
+ Property property = (Property)i.next();
+ if (xsdHelper.isAttribute(property) && obj.isSet(property) && !isTransient(property, obj.getType())) {
+ Object value = obj.get(property);
+ QName name =
+ namespaceContext.createQName(xsdHelper.getNamespaceURI(property), xsdHelper
+ .getLocalName(property));
+ attributes.add(new NameValuePair(name, SDOUtil.convertToString(property.getType(), value)));
+ }
+ }
+ } else {
+ Iterator i = obj.getInstanceProperties().iterator();
+ while (i.hasNext()) {
+ Property p = (Property)i.next();
+ if (obj.isSet(p) && !isTransient(p, obj.getType())) {
+ Object value = obj.get(p);
+ if (xsdHelper.isAttribute(p)) {
+ QName name =
+ namespaceContext.createQName(xsdHelper.getNamespaceURI(p), xsdHelper.getLocalName(p));
+ attributes.add(new NameValuePair(name, SDOUtil.convertToString(p.getType(), value)));
+ } else {
+ addProperty(elementList, children, p, value, obj);
+ }
+ }
+ }
+ }
+
+ String prefix = realTypeName.getPrefix();
+ String nameSpaceName = realTypeName.getNamespaceURI();
+
+ if (nameSpaceName != null) {
+ String writerPrefix = xmlWriter.getPrefix(nameSpaceName);
+ if (writerPrefix != null) {
+ xmlWriter.writeStartElement(nameSpaceName, realTypeName.getLocalPart());
+ } else {
+ if (prefix != null) {
+ xmlWriter.writeStartElement(prefix, realTypeName.getLocalPart(), nameSpaceName);
+ xmlWriter.writeNamespace(prefix, nameSpaceName);
+ xmlWriter.setPrefix(prefix, nameSpaceName);
+ } else {
+ xmlWriter.writeStartElement(nameSpaceName, realTypeName.getLocalPart());
+ xmlWriter.writeDefaultNamespace(nameSpaceName);
+ xmlWriter.setDefaultNamespace(nameSpaceName);
+ }
+ }
+ } else {
+ xmlWriter.writeStartElement(realTypeName.getLocalPart());
+ }
+
+ for (NameValuePair pair : attributes) {
+ QName name = (QName)pair.getKey();
+ assert namespaceContext.getPrefix(name.getPrefix()).equals(name.getNamespaceURI());
+ xmlWriter.writeAttribute(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), (String)pair
+ .getValue());
+ }
+
+ for (NameValuePair pair : elementList) {
+ if (ELEMENT_TEXT.equals(pair.getKey().toString())) {
+ xmlWriter.writeCharacters((String)pair.getValue());
+ } else {
+ QName name = (QName)pair.getKey();
+ xmlWriter.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
+ xmlWriter.writeCharacters((String)pair.getValue());
+ xmlWriter.writeEndElement();
+ }
+ }
+
+ for (DataObject child : children) {
+ writeDataObject(child, null, null);
+ }
+ xmlWriter.writeEndElement();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java
new file mode 100644
index 0000000000..96d0ee563c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.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.databinding.sdo2om;
+
+import static org.apache.tuscany.sca.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMDataSource;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class SDODataSource implements OMDataSource {
+ private HelperContext helperContext;
+ private XMLDocument sourceDocument;
+
+ public SDODataSource(XMLDocument source, HelperContext helperContext) {
+ this.sourceDocument = source;
+ this.helperContext = helperContext;
+ }
+
+ public SDODataSource(DataObject obj, HelperContext helperContext) {
+ this.helperContext = helperContext;
+ this.sourceDocument =
+ helperContext.getXMLHelper().createDocument(obj,
+ ROOT_ELEMENT.getNamespaceURI(),
+ ROOT_ELEMENT.getLocalPart());
+ }
+
+ public XMLStreamReader getReader() throws XMLStreamException {
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.createXMLStreamReader(sourceDocument);
+ }
+
+ public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
+ StreamingOMSerializer serializer = new StreamingOMSerializer();
+ serializer.serialize(getReader(), xmlWriter);
+ }
+
+ public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
+ try {
+ helperContext.getXMLHelper().save(sourceDocument, output, null);
+ } catch (Exception e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+ public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
+ try {
+ helperContext.getXMLHelper().save(sourceDocument, writer, null);
+ } catch (IOException e) {
+ throw new XMLStreamException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java
new file mode 100644
index 0000000000..d6ae818f31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.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.databinding.sdo2om;
+
+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.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ * SDO XMLDocument --> AXIOM OMElement transformer
+ * @version $Rev$ $Date$
+ */
+public class XMLDocument2OMElement extends BaseTransformer<XMLDocument, OMElement> implements
+ PullTransformer<XMLDocument, OMElement> {
+
+ public OMElement transform(XMLDocument source, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ SDODataSource dataSource = new SDODataSource(source, helperContext);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMNamespace namespace = factory.createOMNamespace(source.getRootElementURI(), source.getRootElementName());
+ OMElement element = factory.createOMElement(dataSource, source.getRootElementName(), namespace);
+ return element;
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return OMElement.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/module/SDOAxiomModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/module/SDOAxiomModuleActivator.java
new file mode 100644
index 0000000000..dc9ecdafae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/module/SDOAxiomModuleActivator.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.databinding.sdo2om.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.sdo2om.DataObject2OMElement;
+import org.apache.tuscany.sca.databinding.sdo2om.XMLDocument2OMElement;
+
+/**
+ * Module activator for SDO/AXIOM databinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class SDOAxiomModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ transformers.addTransformer(new DataObject2OMElement());
+ transformers.addTransformer(new XMLDocument2OMElement());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..a16317431c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.databinding.sdo2om.module.SDOAxiomModuleActivator \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java
new file mode 100644
index 0000000000..9d32991bf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.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.databinding.sdo2om;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ OMElement element = new DataObject2OMElement().transform(dataObject, context);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+// TODO: This fails with Axiom 1.2.4
+// StringWriter writer = new StringWriter();
+// element.serialize(writer);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..7485910db6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.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.databinding.sdo2om;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * The base class for SDO-related test cases
+ */
+public abstract class SDOTransformerTestCaseBase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+
+ protected HelperContext helperContext;
+ protected String binding = DataObject.class.getName();
+ protected TransformationContext context;
+ protected TransformationContext reversedContext;
+ protected DataObject dataObject;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ helperContext = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(helperContext);
+
+ context = new TransformationContextImpl();
+ context.setSourceDataType(getSourceDataType());
+ context.setTargetDataType(getTargetDataType());
+
+ reversedContext = new TransformationContextImpl();
+ reversedContext.setSourceDataType(getTargetDataType());
+ reversedContext.setTargetDataType(getSourceDataType());
+
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ address.setStreet("123 ABC St");
+ address.setState("CA");
+ address.setStreet("95131");
+ po.setBillTo(address);
+ dataObject = (DataObject) po;
+ }
+
+ protected abstract DataType<?> getSourceDataType();
+
+ protected abstract DataType<?> getTargetDataType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java
new file mode 100644
index 0000000000..e141e27098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.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.databinding.sdo2om;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLStreamException;
+
+import junit.framework.Assert;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2OMElementTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLDocument document =
+ helperContext.getXMLHelper().createDocument(dataObject,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ OMElement element = new XMLDocument2OMElement().transform(document, context);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
+ StringWriter writer = new StringWriter();
+ element.serialize(writer);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/stock.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo-axiom/src/test/resources/stock.xsd
@@ -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.
+-->
+<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="string" />
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.checkstyle
new file mode 100644
index 0000000000..c7b30ffd5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.checkstyle
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.ruleset
new file mode 100644
index 0000000000..27b9ab847c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/.ruleset
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/pom.xml
new file mode 100755
index 0000000000..4a244a0a58
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <name>Apache Tuscany Data Binding for SDO</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <!-- FIXME: We might want to create a separate module to host the processor -->
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ </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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-po-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
+ <javaPackage>com.example.ipo.sdo</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-stock-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
+ <javaPackage>com.example.stock.sdo</javaPackage>
+ <prefix>Stock</prefix>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java
new file mode 100755
index 0000000000..405de57ab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+public class DataObject2String extends BaseTransformer<DataObject, String> implements
+ PullTransformer<DataObject, String> {
+
+ public String transform(DataObject source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
+ return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java
new file mode 100755
index 0000000000..5b258b5429
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.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.sca.databinding.sdo;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class DataObject2XMLStreamReader extends BaseTransformer<DataObject, XMLStreamReader> implements
+ PullTransformer<DataObject, XMLStreamReader> {
+
+ public XMLStreamReader transform(DataObject source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ QName elementName = SDOContextHelper.getElement(context.getSourceDataType());
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ XMLDocument document =
+ xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
+ return streamHelper.createXMLStreamReader(document);
+ } catch (XMLStreamException e) {
+ // TODO: Add context to the exception
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return DataObject.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DuplicateHelperContextException.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DuplicateHelperContextException.java
new file mode 100644
index 0000000000..c83e93dc4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DuplicateHelperContextException.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.databinding.sdo;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DuplicateHelperContextException extends RuntimeException {
+ private static final long serialVersionUID = -5229624905543066038L;
+
+ /**
+ * Constructor specifying message and the ID of the duplicate HelperContext.
+ *
+ * @param message exception message
+ * @param identifier the id of the HelperContext that is already present
+ */
+ public DuplicateHelperContextException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessor.java
new file mode 100644
index 0000000000..561e5f3b39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessor.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.sca.databinding.sdo;
+
+import java.beans.Introspector;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * Processes {@link @HelperContext} annotations on a component implementation
+ * and adds a {@link JavaMappedProperty} to the component type which will be
+ * used to inject the appropriate context
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelperContextProcessor extends BaseJavaClassVisitor {
+ private HelperContextRegistry registry;
+
+ /**
+ * @param registry
+ */
+ public HelperContextProcessor(AssemblyFactory assemblyFactory, HelperContextRegistry registry) {
+ super(assemblyFactory);
+ this.registry = registry;
+ }
+
+ /**
+ * Takes a setter or getter method name and converts it to a property name
+ * according to JavaBean conventions. For example, <code>setFoo(var)</code>
+ * is returned as property <code>foo<code>
+ */
+ public static String toPropertyName(String name) {
+ if (!name.startsWith("set")) {
+ return name;
+ }
+ return Introspector.decapitalize(name.substring(3));
+ }
+
+ public void visitMethod(Method method,
+ JavaImplementation type) throws IntrospectionException {
+ if (!method.isAnnotationPresent(org.apache.tuscany.sca.databinding.sdo.api.HelperContext.class)) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalArgumentException("HelperContext setter must have one parameter: " + method);
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ if (HelperContext.class == paramType) {
+ String name = toPropertyName(method.getName());
+ JavaResourceImpl resource = new JavaResourceImpl(new JavaElementImpl(method, 0));
+// resource.setObjectFactory(new HelperContextFactory(context.getComponentId()));
+ type.getResources().put(name, resource);
+ }
+ }
+
+ public void visitField(Field field,
+ JavaImplementation type) throws IntrospectionException {
+ if (!field.isAnnotationPresent(org.apache.tuscany.sca.databinding.sdo.api.HelperContext.class)) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (HelperContext.class == paramType) {
+ String name = field.getName();
+ JavaResourceImpl resource = new JavaResourceImpl(new JavaElementImpl(field));
+// resource.setObjectFactory(new HelperContextFactory(context.getComponentId()));
+ type.getResources().put(name, resource);
+ }
+ }
+
+ /*
+ private class HelperContextFactory implements ObjectFactory<HelperContext> {
+ private URI id;
+
+ public HelperContextFactory(URI id) {
+ super();
+ this.id = id;
+ }
+
+ public HelperContext getInstance() throws ObjectCreationException {
+ return registry.getHelperContext(id);
+ }
+
+ }
+ */
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistry.java
new file mode 100644
index 0000000000..75d9d33cbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistry.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.databinding.sdo;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * A registry for SDO HelperContext
+ *
+ * @version $Rev$ $Date$
+ */
+public interface HelperContextRegistry {
+ /**
+ * Register a HelperContext with the id
+ *
+ * @param id
+ * @param context
+ */
+ void register(Object id, HelperContext context) throws DuplicateHelperContextException;
+
+ /**
+ * Unregister the HelperContext
+ *
+ * @param id
+ */
+ void unregister(Object id);
+
+ /**
+ * Get the HelperContext associated with the id
+ *
+ * @param id The URI of the HelperContext
+ * @return
+ */
+ HelperContext getHelperContext(Object id);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistryImpl.java
new file mode 100644
index 0000000000..429946f78d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/HelperContextRegistryImpl.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.databinding.sdo;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * A registry for SDO HelperContext
+ *
+ * @version $Rev$ $Date$
+ */
+public class HelperContextRegistryImpl implements HelperContextRegistry {
+ private final Map<Object, HelperContext> registry = new ConcurrentHashMap<Object, HelperContext>();
+
+ public synchronized void register(Object id, HelperContext context) {
+ if (registry.containsKey(id)) {
+ throw new DuplicateHelperContextException("Duplicate HelperContext: " + id);
+ }
+ registry.put(id, context);
+ }
+
+ public void unregister(Object id) {
+ registry.remove(id);
+ }
+
+ public HelperContext getHelperContext(Object id) {
+ return registry.get(id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java
new file mode 100644
index 0000000000..30a3e1c3a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.impl.BaseImpl;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * The model object for import.sdo
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportSDO extends BaseImpl {
+ public static final QName IMPORT_SDO =
+ new QName("http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0", "import.sdo");
+
+ private HelperContext helperContext;
+ private String factoryClassName;
+ private String schemaLocation;
+
+ public ImportSDO(HelperContext helperContext) {
+ super();
+ this.helperContext = helperContext;
+ setUnresolved(true);
+ }
+
+ public HelperContext getHelperContext() {
+ return helperContext;
+ }
+
+ /**
+ * @return the factoryClassName
+ */
+ public String getFactoryClassName() {
+ return factoryClassName;
+ }
+
+ /**
+ * @param factoryClassName the factoryClassName to set
+ */
+ public void setFactoryClassName(String factoryClassName) {
+ this.factoryClassName = factoryClassName;
+ }
+
+ /**
+ * @return the schemaLocation
+ */
+ public String getSchemaLocation() {
+ return schemaLocation;
+ }
+
+ /**
+ * @param schemaLocation the schemaLocation to set
+ */
+ public void setSchemaLocation(String schemaLocation) {
+ this.schemaLocation = schemaLocation;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java
new file mode 100755
index 0000000000..87b6cb3e4a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.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.databinding.sdo;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static org.apache.tuscany.sca.databinding.sdo.ImportSDO.IMPORT_SDO;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.net.URL;
+
+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.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.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XSDHelper;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Loader that handles &lt;import.sdo&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOProcessor implements StAXArtifactProcessor<ImportSDO> {
+ private HelperContextRegistry helperContextRegistry;
+
+ public ImportSDOProcessor(HelperContextRegistry helperContextRegistry) {
+ super();
+ this.helperContextRegistry = helperContextRegistry;
+ }
+
+ public QName getXMLType() {
+ return IMPORT_SDO;
+ }
+
+ public ImportSDO read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPORT_SDO.equals(reader.getName());
+
+ HelperContext helperContext = null;
+
+ // FIXME: [rfeng] How to get the enclosing composite?
+ int id = System.identityHashCode(reader);
+ // FIXME: [rfeng] How to associate the TypeHelper with deployment
+ // context?
+ synchronized (helperContextRegistry) {
+ helperContext = helperContextRegistry.getHelperContext(id);
+ if (helperContext == null) {
+ helperContext = SDOUtil.createHelperContext();
+ helperContextRegistry.register(id, helperContext);
+ }
+ }
+
+ ImportSDO importSDO = new ImportSDO(helperContext);
+ String factoryName = reader.getAttributeValue(null, "factory");
+ if (factoryName != null) {
+ importSDO.setFactoryClassName(factoryName);
+ }
+ String location = reader.getAttributeValue(null, "location");
+ if (location != null) {
+ importSDO.setSchemaLocation(location);
+ }
+
+ // Skip to end element
+ try {
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && ImportSDO.IMPORT_SDO.equals(reader.getName())) {
+ break;
+ }
+ }
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ return importSDO;
+ }
+
+ private void importFactory(ImportSDO importSDO) throws ContributionResolveException {
+ String factoryName = importSDO.getFactoryClassName();
+ if (factoryName != null) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ try {
+ Class<?> factoryClass = cl.loadClass(factoryName);
+ register(factoryClass, importSDO.getHelperContext());
+ } catch (Exception e) {
+ throw new ContributionResolveException(e);
+ }
+ importSDO.setUnresolved(false);
+ }
+ }
+
+ private static void register(Class factoryClass, HelperContext helperContext) throws Exception {
+ Field field = factoryClass.getField("INSTANCE");
+ Object factory = field.get(null);
+ Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
+ method.invoke(factory, new Object[] {helperContext});
+
+ // FIXME: How do we associate the application HelperContext with the one
+ // imported by the composite
+ HelperContext defaultContext = HelperProvider.getDefaultContext();
+ method.invoke(factory, new Object[] {defaultContext});
+ }
+
+ private void importWSDL(ImportSDO importSDO) throws ContributionResolveException {
+ String location = importSDO.getSchemaLocation();
+ if (location != null) {
+ try {
+ URL wsdlURL = null;
+ URI uri = URI.create(location);
+ if (uri.isAbsolute()) {
+ wsdlURL = uri.toURL();
+ }
+ wsdlURL = Thread.currentThread().getContextClassLoader().getResource(location);
+ if (null == wsdlURL) {
+ ContributionResolveException loaderException = new ContributionResolveException(
+ "WSDL location error");
+ throw loaderException;
+ }
+ InputStream xsdInputStream = wsdlURL.openStream();
+ try {
+ XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
+ xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
+ } finally {
+ xsdInputStream.close();
+ }
+ // FIXME: How do we associate the application HelperContext with
+ // the one
+ // imported by the composite
+ HelperContext defaultContext = HelperProvider.getDefaultContext();
+ xsdInputStream = wsdlURL.openStream();
+ try {
+ XSDHelper xsdHelper = defaultContext.getXSDHelper();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ xsdHelper.define(xsdInputStream, wsdlURL.toExternalForm());
+ } finally {
+ xsdInputStream.close();
+ }
+ } catch (IOException e) {
+ throw new ContributionResolveException(e);
+ }
+ importSDO.setUnresolved(false);
+ }
+ }
+
+ public QName getArtifactType() {
+ return ImportSDO.IMPORT_SDO;
+ }
+
+ public void write(ImportSDO model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Class<ImportSDO> getModelType() {
+ return ImportSDO.class;
+ }
+
+ public void resolve(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
+ importFactory(importSDO);
+ importWSDL(importSDO);
+ if (!importSDO.isUnresolved()) {
+ resolver.addModel(importSDO);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java
new file mode 100644
index 0000000000..78058a5969
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.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.databinding.sdo;
+
+import java.awt.Component;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Helper class to get TypeHelper from the context
+ */
+public final class SDOContextHelper {
+ private SDOContextHelper() {
+ }
+
+ public static HelperContext getHelperContext(TransformationContext context) {
+ if (context == null || context.getMetadata() == null) {
+ return getDefaultHelperContext();
+ }
+ HelperContext helperContext = null;
+ Component composite = (Component)context.getMetadata().get(Component.class);
+ if (composite != null) {
+ // SDOHelperContext sdoContext =
+ // (SDOHelperContext)composite.getExtensions().get(HelperContext.class.getName());
+ // if (sdoContext != null) {
+ // helperContext = sdoContext.getHelperContext();
+ // }
+ // AtomicComponent child =
+ // (AtomicComponent)composite.getSystemChild(HelperContext.class.getName());
+ // try {
+ // helperContext = (HelperContext)child.getTargetInstance();
+ // } catch (TargetResolutionException e) {
+ // helperContext = null;
+ // }
+ }
+ if (helperContext == null) {
+ return getDefaultHelperContext();
+ } else {
+ return helperContext;
+ }
+ }
+
+ public static HelperContext getHelperContext(Composite model) {
+ HelperContext helperContext = null;
+ for (Object ext : model.getExtensions()) {
+ if (ext instanceof HelperContext) {
+ helperContext = (HelperContext)ext;
+ break;
+ }
+ }
+ if (helperContext == null) {
+ helperContext = SDOUtil.createHelperContext();
+ model.getExtensions().add(helperContext);
+ }
+
+ if (helperContext == null) {
+ helperContext = getDefaultHelperContext();
+ }
+
+ return helperContext;
+ }
+
+ protected static HelperContext getDefaultHelperContext() {
+ // SDOUtil.createHelperContext();
+ return HelperProvider.getDefaultContext();
+ }
+
+ public static QName getElement(DataType<?> dataType) {
+ Object logical = dataType.getLogical();
+ QName elementName = SDODataBinding.ROOT_ELEMENT;
+ if (logical instanceof XMLType) {
+ XMLType xmlType = (XMLType)logical;
+ QName element = xmlType.getElementName();
+ if (element != null) {
+ elementName = element;
+ }
+ }
+ return elementName;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
new file mode 100644
index 0000000000..2736d4bbde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.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.databinding.sdo;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.CopyHelper;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * SDO Databinding
+ *
+ * @version $Reve$ $Date$
+ */
+public class SDODataBinding extends BaseDataBinding {
+ public static final String NAME = DataObject.class.getName();
+ public static final String[] ALIASES = new String[] {"sdo"};
+
+ public static final String ROOT_NAMESPACE = "commonj.sdo";
+ public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "dataObject");
+
+ private WrapperHandler<Object> wrapperHandler;
+
+ public SDODataBinding() {
+ super(NAME, ALIASES, DataObject.class);
+ wrapperHandler = new SDOWrapperHandler();
+ }
+
+ @Override
+ public boolean introspect(DataType dataType, Annotation[] annotations) {
+ Object physical = dataType.getPhysical();
+ if (!(physical instanceof Class)) {
+ return false;
+ }
+ Class javaType = (Class)physical;
+ HelperContext context = HelperProvider.getDefaultContext();
+ // FIXME: Need a better to test dynamic SDO
+ if (DataObject.class.isAssignableFrom(javaType)) {
+ // Dynamic SDO
+ dataType.setDataBinding(getName());
+ dataType.setLogical(XMLType.UNKNOWN);
+ return true;
+ }
+ // FIXME: We need to access HelperContext
+ Type type = context.getTypeHelper().getType(javaType);
+ if (type == null) {
+ return false;
+ }
+ if (type.isDataType()) {
+ // FIXME: Ignore simple types?
+ return false;
+ }
+ String namespace = type.getURI();
+ String name = context.getXSDHelper().getLocalName(type);
+ QName xmlType = new QName(namespace, name);
+ dataType.setDataBinding(getName());
+ dataType.setLogical(new XMLType(null, xmlType));
+ return true;
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return wrapperHandler;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SDOSimpleTypeMapper();
+ }
+
+ @Override
+ public Object copy(Object arg) {
+ HelperContext context = HelperProvider.getDefaultContext();
+ CopyHelper copyHelper = context.getCopyHelper();
+ if (arg instanceof XMLDocument) {
+ XMLDocument document = (XMLDocument)arg;
+ DataObject dataObject = copyHelper.copy(document.getRootObject());
+ return context.getXMLHelper().createDocument(dataObject,
+ document.getRootElementURI(),
+ document.getRootElementName());
+ } else if (arg instanceof DataObject) {
+ return context.getCopyHelper().copy((DataObject)arg);
+ } else {
+ return super.copy(arg);
+ }
+ }
+
+ @Override
+ public ExceptionHandler getExceptionHandler() {
+ return new SDOExceptionHandler();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandler.java
new file mode 100644
index 0000000000..1056d2ec38
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandler.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.sca.databinding.sdo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * SDO implementation of ExceptionHandler
+ *
+ * @version $Rev$ $Date$
+ */
+public class SDOExceptionHandler implements ExceptionHandler {
+ private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
+
+ // FIXME: Need a way to pass in the HelperContext
+ private HelperContext helperContext = HelperProvider.getDefaultContext();
+
+ /**
+ * <ul>
+ * <li>WrapperException(String message, FaultBean faultInfo) <br>
+ * A constructor where WrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean.
+ * <li> WrapperException(String message, FaultBean faultInfo, Throwable
+ * cause) <br>
+ * A constructor whereWrapperException is replaced with the name of the
+ * generated wrapper exception and FaultBean is replaced by the name of the
+ * generated fault bean. The last argument, cause, may be used to convey
+ * protocol specific fault information
+ * </ul>
+ */
+ public Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause) {
+ Class exceptionClass = (Class)exceptionType.getPhysical();
+ DataType<?> faultBeanType = exceptionType.getLogical();
+ Class faultBeanClass = (Class)faultBeanType.getPhysical();
+ try {
+ Constructor constructor =
+ exceptionClass.getConstructor(new Class[] {String.class, faultBeanClass, Throwable.class});
+ return (Exception)constructor.newInstance(new Object[] {message, faultInfo, cause});
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Object getFaultInfo(Exception exception) {
+ if (exception == null) {
+ return null;
+ }
+ try {
+ Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ return method.invoke(exception, (Object[])null);
+ } catch (Throwable e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public DataType<?> getFaultType(DataType exceptionDataType) {
+ Class exceptionType = (Class) exceptionDataType.getPhysical();
+ Class faultBeanClass = null;
+ try {
+ Method method = exceptionType.getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
+ faultBeanClass = method.getReturnType();
+ } catch (NoSuchMethodException e) {
+ faultBeanClass = null;
+ }
+ if (faultBeanClass == null) {
+ return null;
+ }
+
+ QName faultElement = null;
+ try {
+ Field field = exceptionType.getField("FAULT_ELEMENT");
+ faultElement = (QName)field.get(null);
+ } catch (NoSuchFieldException e) {
+ // Fall back to type inspection
+ Type type = helperContext.getTypeHelper().getType(faultBeanClass);
+ if (type != null) {
+ String ns = type.getURI();
+ String name = helperContext.getXSDHelper().getLocalName(type);
+ faultElement = new QName(ns, name);
+ }
+ } catch (Throwable e) {
+ // Ignore
+ }
+ if (faultElement == null) {
+ return null;
+ }
+ DataType<XMLType> faultType =
+ new DataTypeImpl<XMLType>(SDODataBinding.NAME, faultBeanClass, new XMLType(faultElement, null));
+ return faultType;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java
new file mode 100644
index 0000000000..f4e2044aa2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.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.sca.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.TypeHelper;
+
+/**
+ * SDO Java/XML mapping for simple XSD types
+ */
+public class SDOSimpleTypeMapper implements SimpleTypeMapper {
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+
+ public SDOSimpleTypeMapper() {
+ super();
+ }
+
+ public Object toJavaObject(QName typeName, String value, TransformationContext context) {
+ Type type = null;
+ if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
+ type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
+ } else {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ TypeHelper typeHelper = helperContext.getTypeHelper();
+ type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
+ }
+ return SDOUtil.createFromString(type, value);
+ }
+
+ public String toXMLLiteral(QName typeName, Object obj, TransformationContext context) {
+ Type type = null;
+ if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
+ type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
+ } else {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ TypeHelper typeHelper = helperContext.getTypeHelper();
+ type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
+ }
+ return SDOUtil.convertToString(type, obj);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java
new file mode 100644
index 0000000000..d89627da71
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.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.sca.databinding.sdo;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Sequence;
+import commonj.sdo.Type;
+import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+/**
+ * SDO Wrapper Handler
+ */
+public class SDOWrapperHandler implements WrapperHandler<Object> {
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#create(ElementInfo, TransformationContext)
+ */
+ public Object create(ElementInfo element, TransformationContext context) {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ QName typeName = element.getType().getQName();
+ DataFactory dataFactory = helperContext.getDataFactory();
+ DataObject root = dataFactory.create(typeName.getNamespaceURI(), typeName.getLocalPart());
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ return xmlHelper.createDocument(root, element.getQName().getNamespaceURI(), element.getQName().getLocalPart());
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.WrapperHandler#setChild(java.lang.Object, int, ElementInfo,
+ * java.lang.Object)
+ */
+ public void setChild(Object wrapper, int i, ElementInfo childElement, Object value) {
+ DataObject wrapperDO =
+ (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
+ wrapperDO.set(i, value);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getChildren(Object wrapper) {
+ DataObject wrapperDO =
+ (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
+ List<Property> properties = wrapperDO.getInstanceProperties();
+ List<Object> elements = new ArrayList<Object>();
+ Type type = wrapperDO.getType();
+ if (type.isSequenced()) {
+ // Add values in the sequence
+ Sequence sequence = wrapperDO.getSequence();
+ for (int i = 0; i < sequence.size(); i++) {
+ // Skip mixed text
+ if (sequence.getProperty(i) != null) {
+ elements.add(sequence.getValue(i));
+ }
+ }
+ } else {
+ for (Property p : properties) {
+ Object child = wrapperDO.get(p);
+ if (p.isMany()) {
+ for (Object c : (Collection<?>)child) {
+ elements.add(c);
+ }
+ } else {
+ elements.add(child);
+ }
+ }
+ }
+ return elements;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java
new file mode 100755
index 0000000000..01ec74bb30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.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.databinding.sdo;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLHelper;
+
+public class String2DataObject extends BaseTransformer<String, DataObject> implements
+ PullTransformer<String, DataObject> {
+
+ public DataObject transform(String source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ return xmlHelper.load(source).getRootObject();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java
new file mode 100644
index 0000000000..d11e6e46d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.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 org.apache.tuscany.sca.databinding.sdo;
+
+import java.io.StringWriter;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+
+public class XMLDocument2String extends BaseTransformer<XMLDocument, String> implements
+ PullTransformer<XMLDocument, String> {
+
+ public String transform(XMLDocument source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLHelper xmlHelper = helperContext.getXMLHelper();
+ StringWriter writer = new StringWriter();
+ xmlHelper.save(source, writer, null);
+ return writer.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java
new file mode 100755
index 0000000000..9e888258f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class XMLDocument2XMLStreamReader extends BaseTransformer<XMLDocument, XMLStreamReader> implements
+ PullTransformer<XMLDocument, XMLStreamReader> {
+ /**
+ * @param source
+ * @param context
+ * @return
+ */
+ public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.createXMLStreamReader(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLDocument.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 10;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java
new file mode 100755
index 0000000000..8797ed1f28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+public class XMLStreamReader2DataObject extends BaseTransformer<XMLStreamReader, DataObject> implements
+ PullTransformer<XMLStreamReader, DataObject> {
+
+ public DataObject transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ // The XMLStreamHelper requires that the reader is posistioned at
+ // START_ELEMENT
+ while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) {
+ source.next();
+ }
+ return streamHelper.loadObject(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return DataObject.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java
new file mode 100755
index 0000000000..43b05d9cb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sdo.helper.XMLStreamHelper;
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+
+public class XMLStreamReader2XMLDocument extends BaseTransformer<XMLStreamReader, XMLDocument> implements
+ PullTransformer<XMLStreamReader, XMLDocument> {
+
+ public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ HelperContext helperContext = SDOContextHelper.getHelperContext(context);
+ XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext.getTypeHelper());
+ return streamHelper.load(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getTargetType() {
+ return XMLDocument.class;
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 15;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/api/HelperContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/api/HelperContext.java
new file mode 100644
index 0000000000..9b6beead14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/api/HelperContext.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.databinding.sdo.api;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation can be used by component implementation class to receive the
+ * SDO HelperContext.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface HelperContext {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/module/SDODataBindingModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/module/SDODataBindingModuleActivator.java
new file mode 100644
index 0000000000..4f6caa6ec0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/module/SDODataBindingModuleActivator.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.databinding.sdo.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.sdo.DataObject2String;
+import org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.sdo.HelperContextProcessor;
+import org.apache.tuscany.sca.databinding.sdo.HelperContextRegistry;
+import org.apache.tuscany.sca.databinding.sdo.HelperContextRegistryImpl;
+import org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor;
+import org.apache.tuscany.sca.databinding.sdo.SDODataBinding;
+import org.apache.tuscany.sca.databinding.sdo.String2DataObject;
+import org.apache.tuscany.sca.databinding.sdo.XMLDocument2String;
+import org.apache.tuscany.sca.databinding.sdo.XMLDocument2XMLStreamReader;
+import org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2DataObject;
+import org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2XMLDocument;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospectorExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SDODataBindingModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ dataBindings.addDataBinding(new SDODataBinding());
+
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ HelperContextRegistry contextRegistry = new HelperContextRegistryImpl();
+ processors.addArtifactProcessor(new ImportSDOProcessor(contextRegistry));
+
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ transformers.addTransformer(new DataObject2String());
+ transformers.addTransformer(new DataObject2XMLStreamReader());
+ transformers.addTransformer(new XMLDocument2String());
+ transformers.addTransformer(new String2DataObject());
+ transformers.addTransformer(new XMLDocument2XMLStreamReader());
+ transformers.addTransformer(new XMLStreamReader2DataObject());
+ transformers.addTransformer(new XMLStreamReader2XMLDocument());
+
+ JavaClassIntrospectorExtensionPoint introspectors = registry.getExtensionPoint(JavaClassIntrospectorExtensionPoint.class);
+ introspectors.addClassVisitor(new HelperContextProcessor(assemblyFactory, contextRegistry));
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..b39b5ae567
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.databinding.sdo.module.SDODataBindingModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java
new file mode 100644
index 0000000000..8c4f243df5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.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 com.example.stock.sdo.fault;
+
+import javax.xml.namespace.QName;
+
+import com.example.stock.sdo.InvalidSymbolFault;
+
+/**
+ * Hand-crafted java exception for SDO fault
+ *
+ */
+public class InvalidSymbolFault_Exception extends Exception {
+ /**
+ * Generated QName for the fault element
+ */
+ public static final QName FAULT_ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ */
+ private InvalidSymbolFault faultInfo;
+
+ /**
+ * @param faultInfo
+ * @param message
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return returns fault bean:
+ * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
+ */
+ public InvalidSymbolFault getFaultInfo() {
+ return faultInfo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java
new file mode 100644
index 0000000000..3665434cee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.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.databinding.sdo;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.DataObject;
+
+/**
+ *
+ */
+public class DataObject2StringTestCase extends SDOTransformerTestCaseBase {
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<Class<String>>(String.class, String.class);
+ }
+
+ public final void testTransform() {
+ String xml = new DataObject2String().transform(dataObject, context);
+ Assert.assertTrue(xml.indexOf("<city>San Jose</city>") != -1);
+ DataObject po = new String2DataObject().transform(xml, reversedContext);
+ Assert.assertTrue(po instanceof PurchaseOrderType);
+ PurchaseOrderType orderType = (PurchaseOrderType)po;
+ Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
+ }
+
+ public final void testXML() {
+ String xml =
+ "<foo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ + "xmlns:ipo=\"http://www.example.com/IPO\" xsi:type=\"ipo:USAddress\"/>";
+ DataObject dataObject = new String2DataObject().transform(xml, reversedContext);
+ context.setSourceDataType(new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, null));
+ xml = new DataObject2String().transform(dataObject, context);
+ Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\""));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..369912f115
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+
+/**
+ *
+ */
+public class DataObject2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context);
+ while (reader.hasNext()) {
+ int event = reader.next();
+ if (event == XMLStreamConstants.START_ELEMENT) {
+ break;
+ }
+ }
+ new XMLStreamReader2DataObject().transform(reader, reversedContext);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessorTestCase.java
new file mode 100644
index 0000000000..c6fc6813e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/HelperContextProcessorTestCase.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.databinding.sdo;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import javax.xml.stream.XMLInputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+
+import commonj.sdo.helper.HelperContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HelperContextProcessorTestCase extends TestCase {
+
+ @SuppressWarnings("unchecked")
+ public void testProcessor() throws Exception {
+ HelperContextRegistry registry = new HelperContextRegistryImpl();
+ HelperContextProcessor processor = new HelperContextProcessor(new DefaultAssemblyFactory(), registry);
+ URI id = URI.create("/composite1/");
+ XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ JavaImplementation componentType = javaImplementationFactory.createJavaImplementation();
+ componentType.setJavaClass(FooImpl.class);
+ for (Field f : FooImpl.class.getDeclaredFields()) {
+ processor.visitField(f, componentType);
+
+ }
+ for (Method m : FooImpl.class.getMethods()) {
+ processor.visitMethod(m, componentType);
+ }
+
+ JavaResourceImpl r1 = (JavaResourceImpl)componentType.getResources().get("context");
+ assertNotNull(r1);
+ JavaResourceImpl r2 = (JavaResourceImpl)componentType.getResources().get("context2");
+ assertNotNull(r2);
+// HelperContext c1 = (HelperContext)r1.getObjectFactory().getInstance();
+// HelperContext c2 = (HelperContext)r2.getObjectFactory().getInstance();
+// assertSame(c1, c2);
+ }
+
+ private static class FooImpl {
+ @org.apache.tuscany.sca.databinding.sdo.api.HelperContext
+ protected HelperContext context2;
+
+ private HelperContext context;
+
+ @org.apache.tuscany.sca.databinding.sdo.api.HelperContext
+ public void setContext(HelperContext context1) {
+ this.context = context1;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java
new file mode 100755
index 0000000000..cd7a02cb88
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.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.databinding.sdo;
+
+import java.io.StringReader;
+import java.net.URI;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import com.example.ipo.sdo.SdoFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ImportSDOProcessorTestCase extends TestCase {
+ private static boolean inited;
+
+ private ImportSDOProcessor loader;
+ private XMLInputFactory xmlFactory;
+
+ public void testMinimal() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.read(reader) instanceof ImportSDO);
+ }
+
+ public void testLocation() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' location='ipo.xsd'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertTrue(loader.read(reader) instanceof ImportSDO);
+ }
+
+ public void testFactory() throws Exception {
+ String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' " + "factory='"
+ + MockFactory.class.getName()
+ + "'/>";
+ XMLStreamReader reader = getReader(xml);
+ assertFalse(inited);
+ ImportSDO importSDO = loader.read(reader);
+ assertNotNull(importSDO);
+ loader.resolve(importSDO, new TestModelResolver(getClass().getClassLoader()));
+ assertTrue(inited);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ URI id = URI.create("/composite1/");
+ loader = new ImportSDOProcessor(new HelperContextRegistryImpl());
+ xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ protected XMLStreamReader getReader(String xml) throws XMLStreamException {
+ XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
+ reader.next();
+ return reader;
+ }
+
+ public static class MockFactory {
+ public static final Object INSTANCE = SdoFactory.INSTANCE;
+
+ static {
+ ImportSDOProcessorTestCase.inited = true;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java
new file mode 100644
index 0000000000..17e4901cc2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.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.sca.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ *
+ */
+public class SDODataBindingTestCase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+ private SDODataBinding binding;
+ private HelperContext context;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ binding = new SDODataBinding();
+ context = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(context);
+ }
+
+ public final void testIntrospect() {
+ DataType dataType = new DataTypeImpl<Class>(DataObject.class, null);
+ boolean yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertTrue(dataType.getDataBinding().equals(binding.getName()));
+ assertTrue(dataType.getPhysical() == DataObject.class && dataType.getLogical() == XMLType.UNKNOWN);
+ dataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(PurchaseOrderType.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ dataType = new DataTypeImpl<Class>(USAddress.class, null);
+ yes = binding.introspect(dataType, null);
+ assertTrue(yes);
+ assertEquals(USAddress.class, dataType.getPhysical());
+ assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
+ .getTypeName());
+ }
+
+ public final void testCopyRoot() {
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ po.setComment("Comment");
+ Object copy = binding.copy(po);
+ assertTrue(copy instanceof PurchaseOrderType);
+ assertTrue(po != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)po, (DataObject)copy));
+ assertEquals("Comment", ((PurchaseOrderType)copy).getComment());
+ }
+
+ public final void testCopyNonRoot() {
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ Object copy = binding.copy(address);
+ assertTrue(copy instanceof USAddress);
+ assertTrue(address != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)address, (DataObject)copy));
+ assertEquals("San Jose", ((USAddress)copy).getCity());
+ }
+
+ public final void testCopyXMLDocument() {
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ po.setComment("Comment");
+ XMLDocument doc =
+ context.getXMLHelper().createDocument((DataObject)po,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ Object copy = binding.copy(doc);
+ assertTrue(copy instanceof XMLDocument);
+ XMLDocument docCopy = (XMLDocument)copy;
+ assertTrue(doc != copy);
+ assertTrue(context.getEqualityHelper().equal((DataObject)po, docCopy.getRootObject()));
+ assertEquals("Comment", ((PurchaseOrderType)docCopy.getRootObject()).getComment());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandlerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandlerTestCase.java
new file mode 100644
index 0000000000..f8373cfd1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOExceptionHandlerTestCase.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.databinding.sdo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.stock.sdo.InvalidSymbolFault;
+import com.example.stock.sdo.StockFactory;
+import com.example.stock.sdo.fault.InvalidSymbolFault_Exception;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * Test case for SDOExceptionHandler
+ */
+public class SDOExceptionHandlerTestCase extends TestCase {
+ // FIXME: Tuscany SDO impl uses _._type for anonymouse type, by the SDO
+ // spec, it should be same as the
+ // enclosing element/attribute name
+ private SDOExceptionHandler handler;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.handler = new SDOExceptionHandler();
+ StockFactory.INSTANCE.register(HelperProvider.getDefaultContext());
+ }
+
+ public void testGetFaultType() {
+ DataType execType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> dataType = handler.getFaultType(execType);
+ assertEquals(InvalidSymbolFault.class, dataType.getPhysical());
+ assertEquals(InvalidSymbolFault_Exception.FAULT_ELEMENT, ((XMLType) dataType.getLogical()).getElementName());
+ assertEquals(SDODataBinding.NAME, dataType.getDataBinding());
+ }
+
+ public void testCreate() {
+ DataType execType = new DataTypeImpl<XMLType>(InvalidSymbolFault_Exception.class, XMLType.UNKNOWN);
+ DataType<?> faultType = handler.getFaultType(execType);
+ InvalidSymbolFault fault = StockFactory.INSTANCE.createInvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ DataType<DataType> exType = new DataTypeImpl<DataType>(InvalidSymbolFault_Exception.class, faultType);
+ Exception ex = handler.createException(exType, "Invalid symbol", fault, null);
+ assertTrue(ex instanceof InvalidSymbolFault_Exception);
+ InvalidSymbolFault_Exception exception = (InvalidSymbolFault_Exception)ex;
+ assertEquals("Invalid symbol", exception.getMessage());
+ assertSame(fault, exception.getFaultInfo());
+ }
+
+ public void testGetFaultInfo() {
+ InvalidSymbolFault fault = StockFactory.INSTANCE.createInvalidSymbolFault();
+ fault.setMessage("ABC");
+ fault.setSymbol("IBM0");
+ InvalidSymbolFault_Exception exception = new InvalidSymbolFault_Exception("Invalid symbol", fault);
+ Object faultInfo = handler.getFaultInfo(exception);
+ assertSame(fault, faultInfo);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java
new file mode 100644
index 0000000000..ff1ac633a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.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.databinding.sdo;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import com.example.ipo.sdo.SdoFactory;
+import com.example.ipo.sdo.USAddress;
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.impl.HelperProvider;
+
+/**
+ * The base class for SDO-related test cases
+ */
+public abstract class SDOTransformerTestCaseBase extends TestCase {
+ protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
+
+ protected HelperContext helperContext;
+ protected String binding = DataObject.class.getName();
+ protected TransformationContext context;
+ protected TransformationContext reversedContext;
+ protected DataObject dataObject;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ helperContext = HelperProvider.getDefaultContext();
+ SdoFactory.INSTANCE.register(helperContext);
+
+ context = new TransformationContextImpl();
+ context.setSourceDataType(getSourceDataType());
+ context.setTargetDataType(getTargetDataType());
+
+ reversedContext = new TransformationContextImpl();
+ reversedContext.setSourceDataType(getTargetDataType());
+ reversedContext.setTargetDataType(getSourceDataType());
+
+ PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
+ USAddress address = SdoFactory.INSTANCE.createUSAddress();
+ address.setCity("San Jose");
+ address.setStreet("123 ABC St");
+ address.setState("CA");
+ address.setStreet("95131");
+ po.setBillTo(address);
+ dataObject = (DataObject) po;
+ }
+
+ protected abstract DataType<?> getSourceDataType();
+
+ protected abstract DataType<?> getTargetDataType();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java
new file mode 100644
index 0000000000..1c3358a4d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.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.databinding.sdo;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XMLDocument;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SDOWrapperHandlerTestCase extends TestCase {
+ private HelperContext context;
+ private SDOWrapperHandler handler;
+
+ public void setUp() throws Exception {
+ context = SDOUtil.createHelperContext();
+ handler = new SDOWrapperHandler();
+ }
+
+ public void testWrapperAnyType() throws Exception {
+ XMLHelper xmlHelper = context.getXMLHelper();
+ XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
+ List children = handler.getChildren(document);
+ assertEquals(5, children.size());
+ }
+
+ public void testWrapper() throws Exception {
+ XSDHelper xsdHelper = context.getXSDHelper();
+ xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
+ XMLHelper xmlHelper = context.getXMLHelper();
+ XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
+ List children = handler.getChildren(document);
+ assertEquals(5, children.size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java
new file mode 100644
index 0000000000..f1caa4e8a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/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.databinding.sdo;
+
+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(ClassLoader classLoader) {
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..78bc62eb3a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.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.databinding.sdo;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+import com.example.ipo.sdo.PurchaseOrderType;
+import commonj.sdo.helper.XMLDocument;
+
+/**
+ *
+ */
+public class XMLDocument2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
+
+ @Override
+ protected DataType<?> getSourceDataType() {
+ return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
+ }
+
+ @Override
+ protected DataType<?> getTargetDataType() {
+ return new DataTypeImpl<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
+ }
+
+ public final void testTransform() throws XMLStreamException {
+ XMLDocument document =
+ helperContext.getXMLHelper().createDocument(dataObject,
+ ORDER_QNAME.getNamespaceURI(),
+ ORDER_QNAME.getLocalPart());
+ XMLStreamReader reader = new XMLDocument2XMLStreamReader().transform(document, context);
+ XMLDocument document2 = new XMLStreamReader2XMLDocument().transform(reader, reversedContext);
+ Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), document2.getRootElementURI());
+ Assert.assertEquals(ORDER_QNAME.getLocalPart(), document2.getRootElementName());
+ Assert.assertTrue(document2.getRootObject() instanceof PurchaseOrderType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/ipo.xsd
new file mode 100755
index 0000000000..241ec15d36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-core.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-core.xsd
new file mode 100755
index 0000000000..56c6977254
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-core.xsd
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/sca/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9"
+ elementFormDefault="qualified">
+
+ <element name="componentType" type="sca:ComponentType"/>
+ <complexType name="ComponentType">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="service" type="sca:Service"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="reference" type="sca:Reference"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="property" type="sca:Property"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Service">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="interface" type="sca:Interface"/>
+ <complexType name="Interface"/>
+
+ <complexType name="Reference">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="Property">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="type" type="QName" use="required"/>
+ <attribute name="many" type="boolean" default="false" use="optional"/>
+ <attribute name="required" type="boolean" default="false" use="optional"/>
+ <attribute name="default" type="string" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <element name="moduleFragment" type="sca:ModuleFragment"/>
+ <complexType name="ModuleFragment">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="component" type="sca:Component"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:ModuleWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="module" type="sca:Module"/>
+ <complexType name="Module">
+ <complexContent>
+ <extension base="sca:ModuleFragment"/>
+ </complexContent>
+ </complexType>
+
+ <complexType name="EntryPoint">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="1" maxOccurs="unbounded" ref="sca:binding"/>
+ <element minOccurs="1" maxOccurs="unbounded" name="reference" type="anyURI"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="multiplicity" type="sca:Multiplicity" use="optional" default="1..1"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..n sample
+ <reference>StockQuoteComponent</reference> - type must be URI
+ a multiplicity 1..n or 0..n sample
+ <reference>StockQuoteComponent1</reference> - type must be URI
+ <reference>StockQuoteComponent2</reference>
+ -->
+
+ <element name="binding" type="sca:Binding"/>
+ <complexType name="Binding">
+ <attribute name="uri" type="anyURI" use="optional"/>
+ </complexType>
+
+ <complexType name="Component">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:implementation"/>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+ <!-- a multiplicity 1..1 or 0..1 sample
+ <references>
+ <v:stockQuote>StockQuoteComponent</v:stockquote> - type must be URI
+ </references>
+ a multiplicity 1..n or 0..n sample
+ <references>
+ <v:stockQuote>StockQuoteComponent1</v:stockQuote> - type must be URI
+ <v:stockQuote>StockQuoteComponent2</v:stockQuote>
+ </references>
+ -->
+
+ <element name="implementation" type="sca:Implementation"/>
+ <complexType name="Implementation"/>
+
+ <complexType name="PropertyValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ReferenceValues">
+ <sequence>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ExternalService">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:interface"/>
+ <element minOccurs="0" maxOccurs="unbounded" ref="sca:binding"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="overridable" type="sca:OverrideOptions" default="may" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+
+ <complexType name="ModuleWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source.uri"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target.uri"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <element name="source" type="anyType"/>
+ <element name="target" type="anyType"/>
+
+ <element name="source.uri" type="anyURI" substitutionGroup="sca:source"/>
+ <element name="target.uri" type="anyURI" substitutionGroup="sca:target"/>
+
+ <element name="subsystem" type="sca:Subsystem"/>
+ <complexType name="Subsystem">
+ <sequence>
+ <element minOccurs="0" maxOccurs="unbounded" name="entryPoint" type="sca:EntryPoint"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="moduleComponent" type="sca:ModuleComponent"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="externalService" type="sca:ExternalService"/>
+ <element minOccurs="0" maxOccurs="unbounded" name="wire" type="sca:SystemWire"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ModuleComponent">
+ <sequence>
+ <element minOccurs="0" maxOccurs="1" name="properties" type="sca:PropertyValues"/>
+ <element minOccurs="0" maxOccurs="1" name="references" type="sca:ReferenceValues"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="module" type="NCName" use="required"/>
+ <attribute name="uri" type="anyURI" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="SystemWire">
+ <sequence>
+ <element minOccurs="1" maxOccurs="1" ref="sca:source"/>
+ <element minOccurs="1" maxOccurs="1" ref="sca:target"/>
+ <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <element name="source.epr" type="anyType" substitutionGroup="sca:source"/>
+ <element name="target.epr" type="anyType" substitutionGroup="sca:target"/>
+
+ <simpleType name="Multiplicity">
+ <restriction base="string">
+ <enumeration value="0..1"/>
+ <enumeration value="1..1"/>
+ <enumeration value="0..n"/>
+ <enumeration value="1..n"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="OverrideOptions">
+ <restriction base="string">
+ <enumeration value="no"/>
+ <enumeration value="may"/>
+ <enumeration value="must"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd
new file mode 100755
index 0000000000..bbaf58f00c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/model/sca-implementation-mock.xsd
@@ -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.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://www.osoa.org/xmlns/mock/0.9"
+ elementFormDefault="qualified"
+ xmlns:mock="http://www.osoa.org/xmlns/mock/0.9"
+ xmlns:sca="http://www.osoa.org/xmlns/sca/0.9">
+
+ <import namespace="http://www.osoa.org/xmlns/sca/0.9"
+ schemaLocation="sca-core.xsd" />
+
+ <element name="implementation.mock" type="mock:MockImplementation"
+ substitutionGroup="sca:implementation" />
+ <complexType name="MockImplementation">
+ <complexContent>
+ <extension base="sca:Implementation">
+ <sequence>
+ <any namespace="##other" processContents="lax"
+ minOccurs="0" maxOccurs="unbounded" />
+ </sequence>
+ <attribute name="myAttr" type="NCName" use="required" />
+ <anyAttribute namespace="##any" processContents="lax" />
+ </extension>
+ </complexContent>
+ </complexType>
+</schema>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/stock.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/stock.xsd
new file mode 100644
index 0000000000..a0a6717371
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/stock.xsd
@@ -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.
+-->
+<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="InvalidSymbolFault">
+ <complexType>
+ <sequence>
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="MarketClosedFault" type="string" />
+
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xml
new file mode 100644
index 0000000000..2526629409
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xml
@@ -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.
+-->
+<p:op xmlns:p="http://www.example.com/wrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.example.com/wrapper wrapper.xsd ">
+ <message>message</message>
+ <symbol>symbol</symbol>
+ <message>message1</message>
+ <symbol>symbol1</symbol>
+ <symbol>symbol2</symbol>
+</p:op>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xsd
new file mode 100644
index 0000000000..ea4dc5f7f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding-sdo/src/test/resources/wrapper.xsd
@@ -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.
+-->
+<schema targetNamespace="http://www.example.com/wrapper" xmlns="http://www.w3.org/2001/XMLSchema">
+ <!-- Faults -->
+ <element name="op">
+ <complexType>
+ <sequence maxOccurs="unbounded">
+ <element name="message" minOccurs="1" type="string" />
+ <element name="symbol" minOccurs="1" maxOccurs="3" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="opResponse">
+ <complexType>
+ <sequence maxOccurs="1">
+ <element name="price" minOccurs="1" maxOccurs="unbounded" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+</schema> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.checkstyle
new file mode 100644
index 0000000000..c7b30ffd5e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.checkstyle
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/.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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/pom.xml
new file mode 100644
index 0000000000..81a1fd6443
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-databinding</artifactId>
+ <name>Apache Tuscany DataBinding Framework</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
new file mode 100644
index 0000000000..e8f5317a25
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.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.sca.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * DataBinding represents a data representation, for example, SDO, JAXB and AXIOM
+ */
+public interface DataBinding {
+ /**
+ * A special databinding for input message of an operation
+ */
+ String IDL_INPUT = "idl:input";
+ /**
+ * A special databinding for output message of an operation
+ */
+ String IDL_OUTPUT = "idl:output";
+ /**
+ * A special databinding for fault message of an operation
+ */
+ String IDL_FAULT = "idl:fault";
+ /**
+ * The name of a databinding should be case-insensitive and unique
+ *
+ * @return The name of the databinding
+ */
+ String getName();
+
+ /**
+ * Get the aliases for the databinding
+ *
+ * @return An array of aliases
+ */
+ String[] getAliases();
+
+ /**
+ * Introspect and populate information to a DataType model
+ *
+ * @param javaType The java class or interface to be introspected
+ * @param annotations The java annotations
+ * @return true if the databinding has recognized the given data type
+ */
+ boolean introspect(DataType dataType, Annotation[] annotations);
+
+ /**
+ * Introspect the data to figure out the corresponding data type
+ *
+ * @param value The object to be checked
+ * @return The DataType or null if the java type is not supported by this databinding
+ */
+ DataType introspect(Object value);
+
+ /**
+ * Provide a WrapperHandler for this databinding
+ * @return A wrapper handler which can handle wrapping/wrapping for this databinding
+ */
+ WrapperHandler getWrapperHandler();
+
+ /**
+ * Make a copy of the object for "pass-by-value" semantics
+ * @param source object to copy
+ * @return copy of the object passed in as argument
+ */
+ Object copy(Object object);
+
+ /**
+ * Get the type mapper for simple types
+ * @return The databinding-specific simple type mapper
+ */
+ SimpleTypeMapper getSimpleTypeMapper();
+
+ /**
+ * Get the handler that can handle exceptions/faults in the
+ * databinding-specific way
+ *
+ * @return An instance of the exception handler
+ */
+ ExceptionHandler getExceptionHandler();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java
new file mode 100644
index 0000000000..471b4b715f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.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.databinding;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * An extension point for data binding extensions.
+ */
+public interface DataBindingExtensionPoint {
+
+ /**
+ * Register a data binding
+ *
+ * @param dataBinding
+ */
+ void addDataBinding(DataBinding dataBinding);
+
+ /**
+ * Look up a data binding by id
+ *
+ * @param id The name of the databinding
+ * @return The databinding
+ */
+ DataBinding getDataBinding(String id);
+
+ /**
+ * Unregister a data binding
+ *
+ * @param id
+ * @return The unregistered databinding
+ */
+ DataBinding removeDataBinding(String id);
+
+ /**
+ * Introspect the java class to figure out what DataType supports it
+ *
+ * @param DataType The initial data type
+ * @param annotations The java annotations
+ * @return A DataType representing the java type or null if no databinding
+ * recognizes the java type
+ */
+ boolean introspectType(DataType dataType, Annotation[] annotations);
+
+ /**
+ * Introspect the value to figure out the corresponding DataType
+ *
+ * @param value The object value
+ * @return A DataType representing the value or null if no databinding
+ * recognizes the value
+ */
+ DataType introspectType(Object value);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java
new file mode 100755
index 0000000000..a6f747996d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.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.sca.databinding;
+
+/**
+ * Data pipe allows a data source pushes data into its sink and pipe the data into its result
+ *
+ * @param <S> The data binding type of the sink
+ * @param <R> The data binding type of the result
+ */
+public interface DataPipe<S, R> extends Transformer {
+
+ /**
+ * Returns a sink (for example, java.io.OutputStream, java.io.Writer or org.xml.sax.ContentHandler) to receive data
+ * pushed by the source
+ *
+ * @return The sink to consume data
+ */
+ S getSink();
+
+ /**
+ * Returns the data populated by the sink
+ *
+ * @return
+ */
+ R getResult();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
new file mode 100644
index 0000000000..cce57cb2ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.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.sca.databinding;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * The default implementation of a data binding extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultDataBindingExtensionPoint implements DataBindingExtensionPoint {
+ private final Map<String, DataBinding> bindings = new HashMap<String, DataBinding>();
+
+ public DataBinding getDataBinding(String id) {
+ if (id == null) {
+ return null;
+ }
+ return bindings.get(id.toLowerCase());
+ }
+
+ public void addDataBinding(DataBinding dataBinding) {
+ bindings.put(dataBinding.getName().toLowerCase(), dataBinding);
+ String[] aliases = dataBinding.getAliases();
+ if (aliases != null) {
+ for (String alias : aliases) {
+ bindings.put(alias.toLowerCase(), dataBinding);
+ }
+ }
+ }
+
+ public DataBinding removeDataBinding(String id) {
+ if (id == null) {
+ return null;
+ }
+ DataBinding dataBinding = bindings.remove(id.toLowerCase());
+ if (dataBinding != null) {
+ String[] aliases = dataBinding.getAliases();
+ if (aliases != null) {
+ for (String alias : aliases) {
+ bindings.remove(alias.toLowerCase());
+ }
+ }
+ }
+ return dataBinding;
+ }
+
+ private Set<DataBinding> getDataBindings() {
+ return new HashSet<DataBinding>(bindings.values());
+ }
+
+ public boolean introspectType(DataType dataType, Annotation[] annotations) {
+ for (DataBinding binding : getDataBindings()) {
+ // don't introspect for JavaBeansDatabinding as all javatypes will
+ // anyways match to its basetype
+ // which is java.lang.Object. Default to this only if no databinding
+ // results
+ if (!binding.getName().equals(JavaBeansDataBinding.NAME)) {
+ if (binding.introspect(dataType, annotations)) {
+ return true;
+ }
+ }
+ }
+ // FIXME: Should we honor the databinding from operation/interface
+ // level?
+ Class physical = dataType.getPhysical();
+ if (physical == Object.class || Throwable.class.isAssignableFrom((Class)physical)) {
+ return false;
+ }
+ dataType.setDataBinding(JavaBeansDataBinding.NAME);
+ return false;
+ }
+
+ public DataType introspectType(Object value) {
+ DataType dataType = null;
+ for (DataBinding binding : getDataBindings()) {
+ // don't introspect for JavaBeansDatabinding as all javatypes will
+ // anyways match to its basetype
+ // which is java.lang.Object. Default to this only if no databinding
+ // results
+ if (!binding.getName().equals(JavaBeansDataBinding.NAME)) {
+ dataType = binding.introspect(value);
+ }
+ if (dataType != null) {
+ return dataType;
+ }
+ }
+ return new DataTypeImpl<Class>(JavaBeansDataBinding.NAME, value.getClass(), value.getClass());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
new file mode 100755
index 0000000000..8c37ce2d89
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.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.databinding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultTransformerExtensionPoint implements TransformerExtensionPoint {
+ private DataBindingExtensionPoint dataBindings;
+
+ private final DirectedGraph<Object, Transformer> graph = new DirectedGraph<Object, Transformer>();
+
+ public DefaultTransformerExtensionPoint(DataBindingExtensionPoint dataBindings) {
+ this.dataBindings = dataBindings;
+ }
+
+ public void addTransformer(String sourceType, String resultType, int weight, Transformer transformer) {
+ graph.addEdge(sourceType, resultType, transformer, weight);
+ }
+
+ public void addTransformer(Transformer transformer) {
+ graph.addEdge(transformer.getSourceDataBinding(),
+ transformer.getTargetDataBinding(),
+ transformer,
+ transformer.getWeight());
+ }
+
+ public boolean removeTransformer(String sourceType, String resultType) {
+ return graph.removeEdge(sourceType, resultType);
+ }
+
+ public Transformer getTransformer(String sourceType, String resultType) {
+ DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType);
+ return (edge == null) ? null : edge.getValue();
+ }
+
+ public List<Transformer> getTransformerChain(String sourceType, String resultType) {
+ String source = normalize(sourceType);
+ String result = normalize(resultType);
+ List<Transformer> transformers = new ArrayList<Transformer>();
+ DirectedGraph<Object, Transformer>.Path path = graph.getShortestPath(source, result);
+ if (path == null) {
+ return null;
+ }
+ for (DirectedGraph<Object, Transformer>.Edge edge : path.getEdges()) {
+ transformers.add(edge.getValue());
+ }
+ return transformers;
+ }
+
+ public String toString() {
+ return graph.toString();
+ }
+
+ /**
+ * Normalize the id to a name of a data binding as databindings may have aliases
+ * @param id
+ * @return
+ */
+ private String normalize(String id) {
+ if (dataBindings != null) {
+ DataBinding dataBinding = dataBindings.getDataBinding(id);
+ return dataBinding == null ? id : dataBinding.getName();
+ } else {
+ return id;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/ExceptionHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/ExceptionHandler.java
new file mode 100644
index 0000000000..131e8a3114
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/ExceptionHandler.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.databinding;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * ExceptionHandler provides databinding-specific logic for exception handling
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionHandler {
+ /**
+ * Create an exception to wrap the fault data
+ *
+ * @param exceptionType The DataType for the exception
+ * @param message The error message
+ * @param faultInfo The databinding-specific fault data
+ * @param cause The protocol-specific error
+ * @return An instance of java exception to represent the fault
+ */
+ Exception createException(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause);
+
+ /**
+ * Retrieve the fault info from a java exception
+ *
+ * @param exception The databinding-specific java exception that represents
+ * the fault data
+ * @return The databinding-specific fault data
+ */
+ Object getFaultInfo(Exception exception);
+
+ /**
+ * Introspect an exception class to figure out the fault data type
+ *
+ * @param exceptionDataType The exception class
+ * @return The data type for the fault
+ */
+ DataType<?> getFaultType(DataType exceptionDataType);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java
new file mode 100755
index 0000000000..168a1052b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.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.sca.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * This interface will be used as a Tuscany system service to perform data mediations
+ *
+ * Mediate the data from one type to the other one
+ *
+ */
+public interface Mediator {
+
+ /**
+ * Mediate the data from the source type to the target type
+ * @param source The data to be mediated
+ * @param sourceDataType Data type for the source data
+ * @param targetDataType Data type for the target data
+ * @param context
+ * @return
+ */
+ Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> context);
+ /**
+ * Mediate the source data into the target which is a sink to receive the data
+ * @param source The data to be mediated
+ * @param target The sink to receive data
+ * @param sourceDataType Data type for the source data
+ * @param targetDataType Data type for the target data
+ */
+ void mediate(
+ Object source,
+ Object target,
+ DataType sourceDataType,
+ DataType targetDataType,
+ Map<String, Object> context);
+
+ /**
+ * Get the DataBindings used by this mediator.
+ * @return
+ */
+ DataBindingExtensionPoint getDataBindings();
+
+ /**
+ * Get the Transformers used by this mediator.
+ * @return
+ */
+ TransformerExtensionPoint getTransformers();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java
new file mode 100644
index 0000000000..feed87e45f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.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.databinding;
+
+/**
+ * PullTransformer transforms data from one binding format to the other one which can be directly consumed
+ *
+ * @param <S> The source data type
+ * @param <R> the target data type
+ */
+public interface PullTransformer<S, R> extends Transformer {
+ /**
+ * Transform source data into the result type.
+ *
+ * @param source The source data
+ * @param context The context for the transformation
+ * @return The transformed result
+ */
+ R transform(S source, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java
new file mode 100644
index 0000000000..80e5e4f0a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.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.databinding;
+
+/**
+ * A transformer that pushes data from its source into the sink
+ *
+ * @param <S>
+ * @param <R>
+ */
+public interface PushTransformer<S, R> extends Transformer {
+ /**
+ * @param source The source data
+ * @param sink The sink to receive the data
+ * @param context
+ */
+ void transform(S source, R sink, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java
new file mode 100644
index 0000000000..70ea431d57
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.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.sca.databinding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Type Mapper between XML schema simple data types and java objects
+ */
+public interface SimpleTypeMapper {
+ /**
+ * Parse the XML lexical representation into a java object
+ * @param simpleType The XSD simple type
+ * @param value the XML lexical representation
+ * @param context The context of the transformation
+ * @return A java object for the XML value
+ */
+ Object toJavaObject(QName simpleType, String value, TransformationContext context);
+ /**
+ * Create the XML lexical representation for a java object
+ * @param simpleType The XSD simple type
+ * @param obj The java object
+ * @param context The context of the transformation
+ * @return The XML lexical representation
+ */
+ String toXMLLiteral(QName simpleType, Object obj, TransformationContext context);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java
new file mode 100755
index 0000000000..27818dc24f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.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.databinding;
+
+import java.util.Map;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Context for data transformation
+ *
+ */
+public interface TransformationContext {
+
+ Operation getSourceOperation();
+ void setSourceOperation(Operation sourceOperation);
+ Operation getTargetOperation();
+ void setTargetOperation(Operation targetOperation);
+
+ /**
+ * Get the source data type
+ *
+ * @return
+ */
+ DataType getSourceDataType();
+
+ /**
+ * Get the target data type
+ *
+ * @return
+ */
+ DataType getTargetDataType();
+
+ /**
+ * Set the source data type
+ *
+ * @param sourceDataType
+ */
+ void setSourceDataType(DataType sourceDataType);
+
+ /**
+ * Set the target data type
+ *
+ * @param targetDataType
+ */
+ void setTargetDataType(DataType targetDataType);
+
+ /**
+ * Get the classloader
+ *
+ * @return
+ */
+ ClassLoader getClassLoader();
+
+ /**
+ * Get a map of metadata
+ *
+ * @return
+ */
+ Map<String, Object> getMetadata();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java
new file mode 100755
index 0000000000..8d2b36482d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.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.databinding;
+
+
+/**
+ * Reports problems during data transformation
+ */
+public class TransformationException extends RuntimeException {
+
+ private static final long serialVersionUID = 7662385613693006428L;
+ private String sourceDataBinding;
+ private String targetDataBinding;
+
+ public TransformationException() {
+ super();
+ }
+
+ public TransformationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public TransformationException(String message) {
+ super(message);
+ }
+
+ public TransformationException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getSourceDataBinding() {
+ return sourceDataBinding;
+ }
+
+ public void setSourceDataBinding(String sourceDataBinding) {
+ this.sourceDataBinding = sourceDataBinding;
+ }
+
+ public String getTargetDataBinding() {
+ return targetDataBinding;
+ }
+
+ public void setTargetDataBinding(String targetDataBinding) {
+ this.targetDataBinding = targetDataBinding;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java
new file mode 100755
index 0000000000..062f087a15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.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.databinding;
+
+/**
+ * A transformer provides the data transformation from source type to target type. The cost of the transformation is
+ * modeled as weight.
+ */
+public interface Transformer {
+ /**
+ * Get the source type that this transformer transforms data from. The type is used as the key when the transformer
+ * is registered with TransformerRegistry.
+ *
+ * @return A key indentifying the source type
+ */
+ String getSourceDataBinding();
+
+ /**
+ * Get the target type that this transformer transforms data into. The type is used as the key when the transformer
+ * is registered with TransformerRegistry.
+ *
+ * @return A key indentifying the target type
+ */
+ String getTargetDataBinding();
+
+ /**
+ * Get the cost of the transformation. The weight can be used to choose the most efficient path if there are more
+ * than one available from the source to the target.
+ *
+ * @return An integer representing the cost of the transformation
+ */
+ int getWeight();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java
new file mode 100755
index 0000000000..1abae06754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.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.databinding;
+
+import java.util.List;
+
+/**
+ * An extension point for data transformer extensions.
+ */
+public interface TransformerExtensionPoint {
+
+ /**
+ * Register a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @param weight
+ * @param transformer
+ */
+ void addTransformer(String sourceDataBinding,
+ String targetDataBinding,
+ int weight,
+ Transformer transformer);
+
+ /**
+ * Register a transformer
+ *
+ * @param transformer
+ */
+ void addTransformer(Transformer transformer);
+
+ /**
+ * Unregister a transformer
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ boolean removeTransformer(String sourceDataBinding, String targetDataBinding);
+
+ /**
+ * Get the direct Transformer which can transform data from source type to
+ * result type
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ Transformer getTransformer(String sourceDataBinding, String targetDataBinding);
+
+ /**
+ * Get the a chain of Transformers which can transform data from source type
+ * to result type
+ *
+ * @param sourceDataBinding
+ * @param targetDataBinding
+ * @return
+ */
+ List<Transformer> getTransformerChain(String sourceDataBinding, String targetDataBinding);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java
new file mode 100644
index 0000000000..a94e986755
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.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.databinding;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+
+/**
+ * A contract for transformers to deal with wrapping/unwrapping for WSDL wrapper style operations
+ */
+public interface WrapperHandler<T> {
+ /**
+ * Create a wrapper element
+ *
+ * @param element The XSD element
+ * @param context The transformation context
+ * @return An object representing the wrapper element
+ */
+ T create(ElementInfo element, TransformationContext context);
+
+ /**
+ * Set child element for the wrapper
+ *
+ * @param wrapper The wrapper
+ * @param i The index
+ * @param childElement The XSD element
+ * @param value The value of the child
+ */
+ void setChild(T wrapper, int i, ElementInfo childElement, Object value);
+
+ /**
+ * Get a list of child elements from the wrapper
+ * @param wrapper
+ * @return child elements under the wrapper
+ */
+ List getChildren(T wrapper);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
new file mode 100644
index 0000000000..1d0e117d34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.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.sca.databinding.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to demarcate expected data types for an operation
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface DataBinding {
+
+ /**
+ * Returns the unique name of the data binding
+ * @return the unique name of the data binding
+ */
+ String value();
+ boolean wrapperStyle() default false;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
new file mode 100644
index 0000000000..377984a1cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.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.sca.databinding.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.ExceptionHandler;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * Base Implementation of DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseDataBinding implements DataBinding {
+
+ protected DataBindingExtensionPoint registry;
+
+ protected Class<?> baseType;
+
+ protected String name;
+ protected String[] aliases;
+
+ /**
+ * Create a databinding with the base java type whose name will be used as
+ * the name of the databinding
+ *
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected BaseDataBinding(Class<?> baseType) {
+ this(baseType.getName(), null, baseType);
+ }
+
+ /**
+ * Create a databinding with the name and base java type
+ *
+ * @param name The name of the databinding
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected BaseDataBinding(String name, Class<?> baseType) {
+ this(name, null, baseType);
+ }
+
+ /**
+ * Create a databinding with the name and base java type
+ *
+ * @param name The name of the databinding
+ * @param aliases The aliases of the databinding
+ * @param baseType The base java class or interface representing the
+ * databinding, for example, org.w3c.dom.Node
+ */
+ protected BaseDataBinding(String name, String[] aliases, Class<?> baseType) {
+ this.name = name;
+ this.baseType = baseType;
+ this.aliases = aliases;
+ }
+
+ public void setDataBindingRegistry(DataBindingExtensionPoint registry) {
+ this.registry = registry;
+ }
+
+ public void init() {
+ registry.addDataBinding(this);
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ assert type != null;
+ Type physical = type.getPhysical();
+ if (physical instanceof ParameterizedType) {
+ physical = ((ParameterizedType)physical).getRawType();
+ }
+ if (physical instanceof Class) {
+ Class cls = (Class)physical;
+ if (baseType != null && baseType.isAssignableFrom(cls)) {
+ type.setDataBinding(getName());
+ type.setLogical(baseType);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public DataType introspect(Object value) {
+ if (value == null) {
+ return null;
+ } else {
+ DataType<Class> dataType = new DataTypeImpl<Class>(value.getClass(), value.getClass());
+ if (introspect(dataType, null)) {
+ return dataType;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.DataBinding#getWrapperHandler()
+ */
+ public WrapperHandler getWrapperHandler() {
+ return null;
+ }
+
+ public ExceptionHandler getExceptionHandler() {
+ return null;
+ }
+
+ public Object copy(Object object) {
+ return object;
+ }
+
+ public SimpleTypeMapper getSimpleTypeMapper() {
+ return new SimpleTypeMapperImpl();
+ }
+
+ public String[] getAliases() {
+ return aliases;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java
new file mode 100644
index 0000000000..5d68324f31
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.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.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+
+/**
+ * Base Implementation of Transformer which provides the registration to the transformer registry
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseTransformer<S, T> implements Transformer {
+
+ protected TransformerExtensionPoint registry;
+
+ protected BaseTransformer() {
+ super();
+ }
+
+ public void setTransformerRegistry(TransformerExtensionPoint registry) {
+ this.registry = registry;
+ }
+
+ public void init() {
+ registry.addTransformer(this);
+ }
+
+ protected abstract Class getSourceType();
+
+ protected abstract Class getTargetType();
+
+ public String getSourceDataBinding() {
+ return getSourceType().getName();
+ }
+
+ public String getTargetDataBinding() {
+ return getTargetType().getName();
+ }
+
+ public int getWeight() {
+ // default to 50
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
new file mode 100644
index 0000000000..2fe4cc44cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.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.databinding.impl;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Helper for DOM
+ */
+public final class DOMHelper {
+ private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance();
+ static {
+ FACTORY.setNamespaceAware(true);
+ }
+
+ private DOMHelper() {
+ }
+
+ public static Document newDocument() throws ParserConfigurationException {
+ return newDocumentBuilder().newDocument();
+ }
+
+ public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
+ return FACTORY.newDocumentBuilder();
+ }
+
+ public static QName getQName(Node node) {
+ String ns = node.getNamespaceURI();
+ if (ns == null) {
+ ns = "";
+ }
+ // node.getLocalName() will return null if it is created using DOM Level
+ // 1 method
+ // such as createElement()
+ return new QName(ns, node.getNodeName());
+ }
+
+ public static Element createElement(Document document, QName name) {
+ String prefix = name.getPrefix();
+ String qname =
+ (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name
+ .getLocalPart();
+ return document.createElementNS(name.getNamespaceURI(), qname);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
new file mode 100755
index 0000000000..d99fe488de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
@@ -0,0 +1,357 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Directed, weighted graph
+ *
+ * @param <V> The type of vertex object
+ * @param <E> The type of edge object
+ */
+public class DirectedGraph<V, E> {
+ private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
+
+ /**
+ * Key for the shortest path cache
+ */
+ private final class VertexPair {
+ private Vertex source;
+
+ private Vertex target;
+
+ /**
+ * @param source
+ * @param target
+ */
+ private VertexPair(Vertex source, Vertex target) {
+ super();
+ this.source = source;
+ this.target = target;
+ }
+
+ public boolean equals(Object object) {
+ if (!VertexPair.class.isInstance(object)) {
+ return false;
+ }
+ VertexPair pair = (VertexPair)object;
+ return source == pair.source && target == pair.target;
+ }
+
+ public int hashCode() {
+ int x = source == null ? 0 : source.hashCode();
+ int y = target == null ? 0 : target.hashCode();
+ return x ^ y;
+ }
+
+ }
+
+ private final Map<VertexPair, Path> paths = new HashMap<VertexPair, Path>();
+
+ /**
+ * Vertex of a graph
+ */
+ public final class Vertex {
+ private V value;
+
+ // TODO: Do we want to support multiple edges for a vertex pair? If so,
+ // we should use a List instead of Map
+ private Map<Vertex, Edge> outEdges = new HashMap<Vertex, Edge>();
+
+ private Vertex(V value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ return "(" + value + ")";
+ }
+
+ public V getValue() {
+ return value;
+ }
+
+ public Map<Vertex, Edge> getOutEdges() {
+ return outEdges;
+ }
+
+ }
+
+ /**
+ * An Edge connects two vertices in one direction
+ */
+ public final class Edge {
+ private Vertex sourceVertex;
+
+ private Vertex targetVertex;
+
+ private E value;
+
+ private int weight;
+
+ public Edge(Vertex source, Vertex target, E value, int weight) {
+ this.sourceVertex = source;
+ this.targetVertex = target;
+ this.value = value;
+ this.weight = weight;
+ }
+
+ public String toString() {
+ return sourceVertex + "->" + targetVertex + "[" + value + "," + weight + "]";
+ }
+
+ public E getValue() {
+ return value;
+ }
+
+ public void setValue(E value) {
+ this.value = value;
+ }
+
+ public Vertex getTargetVertex() {
+ return targetVertex;
+ }
+
+ public void setTargetVertex(Vertex vertex) {
+ this.targetVertex = vertex;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public void setWeight(int weight) {
+ this.weight = weight;
+ }
+
+ public Vertex getSourceVertex() {
+ return sourceVertex;
+ }
+
+ public void setSourceVertex(Vertex sourceVertex) {
+ this.sourceVertex = sourceVertex;
+ }
+ }
+
+ private final class Node implements Comparable<Node> {
+
+ private long distance = Integer.MAX_VALUE;
+
+ private Node previous; // NOPMD by rfeng on 9/26/06 9:17 PM
+
+ private Vertex vertex; // NOPMD by rfeng on 9/26/06 9:17 PM
+
+ private Node(Vertex vertex) {
+ this.vertex = vertex;
+ }
+
+ public int compareTo(Node o) {
+ return (distance > o.distance) ? 1 : ((distance == o.distance) ? 0 : -1);
+ }
+ }
+
+ public void addEdge(V source, V target, E edgeValue, int weight) {
+ Vertex s = getVertex(source);
+ if (s == null) {
+ s = new Vertex(source);
+ vertices.put(source, s);
+ }
+ Vertex t = getVertex(target);
+ if (t == null) {
+ t = new Vertex(target);
+ vertices.put(target, t);
+ }
+ Edge edge = new Edge(s, t, edgeValue, weight);
+ s.outEdges.put(t, edge);
+ }
+
+ public Vertex getVertex(V source) {
+ Vertex s = vertices.get(source);
+ return s;
+ }
+
+ public boolean removeEdge(V source, V target) {
+ Vertex s = getVertex(source);
+ if (s == null) {
+ return false;
+ }
+
+ Vertex t = getVertex(target);
+ if (t == null) {
+ return false;
+ }
+
+ return s.outEdges.remove(t) != null;
+
+ }
+
+ public Edge getEdge(Vertex source, Vertex target) {
+ return source.outEdges.get(target);
+ }
+
+ public Edge getEdge(V source, V target) {
+ return getEdge(getVertex(source), getVertex(target));
+ }
+
+ /**
+ * Get the shortes path from the source vertex to the target vertex using
+ * Dijkstra's algorithm. If there's no path, null will be returned. If the
+ * source is the same as the target, it returns a path with empty edges with
+ * weight 0.
+ *
+ * @param sourceValue The value identifies the source
+ * @param targetValue The value identifies the target
+ * @return The shortest path
+ */
+ public Path getShortestPath(V sourceValue, V targetValue) {
+ Vertex source = getVertex(sourceValue);
+ if (source == null) {
+ return null;
+ }
+ Vertex target = getVertex(targetValue);
+ if (target == null) {
+ return null;
+ }
+
+ VertexPair pair = new VertexPair(source, target);
+ if (paths.containsKey(pair)) {
+ return paths.get(pair);
+ }
+
+ // HACK: To support same vertex
+ if (source == target) {
+ Path path = new Path();
+ Edge edge = getEdge(source, target);
+ if (edge != null) {
+ path.addEdge(edge);
+ }
+ paths.put(pair, path);
+ return path;
+ }
+
+ Map<Vertex, Node> nodes = new HashMap<Vertex, Node>();
+ for (Vertex v : vertices.values()) {
+ Node node = new Node(v);
+ if (v == source) {
+ node.distance = 0;
+ }
+ nodes.put(v, node);
+ }
+
+ Set<Node> otherNodes = new HashSet<Node>(nodes.values());
+ Set<Node> nodesOnPath = new HashSet<Node>();
+ while (!otherNodes.isEmpty()) {
+ Node nextNode = extractMin(otherNodes);
+ if (nextNode.vertex == target) {
+ Path path = getPath(nextNode);
+ paths.put(pair, path); // Cache it
+ return path;
+ }
+ nodesOnPath.add(nextNode);
+ for (Edge edge : nextNode.vertex.outEdges.values()) {
+ Node adjacentNode = nodes.get(edge.targetVertex);
+ if (nextNode.distance + edge.weight < adjacentNode.distance) {
+ adjacentNode.distance = nextNode.distance + edge.weight;
+ adjacentNode.previous = nextNode;
+ }
+ }
+ }
+ paths.put(pair, null); // Cache it
+ return null;
+ }
+
+ /**
+ * Searches for the vertex u in the vertex set Q that has the least d[u]
+ * value. That vertex is removed from the set Q and returned to the user.
+ *
+ * @param nodes
+ * @return
+ */
+ private Node extractMin(Set<Node> nodes) {
+ Node node = Collections.min(nodes);
+ nodes.remove(node);
+ return node;
+ }
+
+ /**
+ * The path between two vertices
+ */
+ public final class Path {
+ private List<Edge> edges = new LinkedList<Edge>();
+
+ private int weight;
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public List<Edge> getEdges() {
+ return edges;
+ }
+
+ public void addEdge(Edge edge) {
+ edges.add(0, edge);
+ weight += edge.weight;
+ }
+
+ public String toString() {
+ return edges + ", " + weight;
+ }
+ }
+
+ private Path getPath(Node t) {
+ if (t.distance == Integer.MAX_VALUE) {
+ return null;
+ }
+ Path path = new Path();
+ Node u = t;
+ while (u.previous != null) {
+ Edge edge = getEdge(u.previous.vertex, u.vertex);
+ path.addEdge(edge);
+ u = u.previous;
+ }
+ return path;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ for (Vertex v : vertices.values()) {
+ sb.append(v.outEdges.values()).append("\n");
+ }
+ return sb.toString();
+ }
+
+ public Map<V, Vertex> getVertices() {
+ return vertices;
+ }
+
+ public void addGraph(DirectedGraph<V, E> otherGraph) {
+ for (Vertex v : otherGraph.vertices.values()) {
+ for (Edge e : v.outEdges.values()) {
+ addEdge(e.sourceVertex.value, e.targetVertex.value, e.value, e.weight);
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java
new file mode 100644
index 0000000000..52917aaf50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.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.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * This is a special transformer to transform the output from one IDL to the
+ * other one
+ */
+public class Group2GroupTransformer extends BaseTransformer<Object, Object> implements
+ PullTransformer<Object, Object> {
+
+ protected Mediator mediator;
+
+ /**
+ * @param wrapperHandler
+ */
+ public Group2GroupTransformer() {
+ super();
+ }
+
+ /**
+ * @param mediator the mediator to set
+ */
+ public void setMediator(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ @Override
+ public String getSourceDataBinding() {
+ return GroupDataBinding.NAME;
+ }
+
+ @Override
+ public String getTargetDataBinding() {
+ return GroupDataBinding.NAME;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
+ */
+ @Override
+ protected Class getSourceType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
+ */
+ @Override
+ protected Class getTargetType() {
+ return Object.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
+ */
+ public int getWeight() {
+ return 10;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object transform(Object source, TransformationContext context) {
+ DataType<DataType> sourceType = context.getSourceDataType();
+ DataType<DataType> targetType = context.getTargetDataType();
+
+ return mediator.mediate(source, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java
new file mode 100644
index 0000000000..2403600389
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.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.sca.databinding.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * The base class for a special databinding which represents a group of other databindings
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class GroupDataBinding extends BaseDataBinding {
+ public static final String NAME = "databinding:group";
+
+ /**
+ * Marker type is a java class or interface representing the data format.
+ */
+ protected Class[] markerTypes;
+
+ public GroupDataBinding(Class[] types) {
+ super(NAME, null, GroupDataBinding.class);
+ this.markerTypes = types;
+ }
+
+ @SuppressWarnings("unchecked")
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (markerTypes == null) {
+ return false;
+ }
+ Type physical = type.getPhysical();
+ if (physical instanceof ParameterizedType) {
+ physical = ((ParameterizedType)physical).getRawType();
+ }
+ if (!(physical instanceof Class)) {
+ return false;
+ }
+ Class cls = (Class)physical;
+ for (Class<?> c : markerTypes) {
+ if (isTypeOf(c, cls)) {
+ type.setDataBinding(getDataBinding(c));
+ type.setLogical(getLogical(cls, annotations));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the given type is a subtype of the base type
+ * @param markerType
+ * @param type
+ * @return
+ */
+ protected boolean isTypeOf(Class<?> markerType, Class<?> type) {
+ return markerType.isAssignableFrom(type);
+ }
+
+ /**
+ * Derive the databinding name from a base class
+ * @param baseType
+ * @return
+ */
+ protected String getDataBinding(Class<?> baseType) {
+ return baseType.getName();
+ }
+
+ /**
+ * Get the logical type
+ * @param type The java type
+ * @param annotations
+ * @return
+ */
+ protected abstract Object getLogical(Class<?> type, Annotation[] annotations);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java
new file mode 100644
index 0000000000..b39a944f32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.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.databinding.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a simple java object to a databinding's representation
+ */
+public abstract class Java2SimpleTypeTransformer<T> extends BaseTransformer<Object, T> implements
+ PullTransformer<Object, T> {
+
+ protected SimpleTypeMapper mapper;
+
+ public Java2SimpleTypeTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public Java2SimpleTypeTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
+ }
+
+ public T transform(Object source, TransformationContext context) {
+ XMLType xmlType = (XMLType) context.getTargetDataType().getLogical();
+ String text = mapper.toXMLLiteral(xmlType.getTypeName(), source, context);
+ return createElement(xmlType.getElementName(), text, context);
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ return 10000;
+ }
+
+ protected abstract T createElement(QName element, String literal, TransformationContext context);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
new file mode 100644
index 0000000000..adff1718de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.databinding.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * Default Mediator implementation
+ */
+public class MediatorImpl implements Mediator {
+
+ private DataBindingExtensionPoint dataBindings;
+ private TransformerExtensionPoint transformers;
+
+ public MediatorImpl(DataBindingExtensionPoint dataBindings,
+ TransformerExtensionPoint transformers) {
+ this.dataBindings = dataBindings;
+ this.transformers = transformers;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> metadata) {
+ if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
+ sourceDataType = dataBindings.introspectType(source);
+ }
+ if (sourceDataType == null) {
+ return source;
+ } else if (sourceDataType.equals(targetDataType)) {
+ return source;
+ }
+
+ List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
+
+ Object result = source;
+ int size = path.size();
+ int i = 0;
+ while (i < size) {
+ Transformer transformer = path.get(i);
+ TransformationContext context = createTransformationContext(sourceDataType,
+ targetDataType,
+ size,
+ i,
+ transformer,
+ metadata);
+ // the source and target type
+ if (transformer instanceof PullTransformer) {
+ // For intermediate node, set data type to null
+ result = ((PullTransformer)transformer).transform(result, context);
+ } else if (transformer instanceof PushTransformer) {
+ DataPipe dataPipe = (i < size - 1) ? (DataPipe)path.get(++i) : null;
+ ((PushTransformer)transformer).transform(result, dataPipe.getSink(), context);
+ result = dataPipe.getResult();
+ }
+ i++;
+ }
+
+ return result;
+ }
+
+ private TransformationContext createTransformationContext(DataType sourceDataType,
+ DataType targetDataType,
+ int size,
+ int index,
+ Transformer transformer,
+ Map<String, Object> metadata) {
+ DataType sourceType = (index == 0) ? sourceDataType : new DataTypeImpl<Object>(transformer
+ .getSourceDataBinding(), Object.class, sourceDataType.getLogical());
+ DataType targetType = (index == size - 1) ? targetDataType : new DataTypeImpl<Object>(transformer
+ .getTargetDataBinding(), Object.class, targetDataType.getLogical());
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ TransformationContext context = new TransformationContextImpl(sourceType, targetType, classLoader, metadata);
+ return context;
+ }
+
+ @SuppressWarnings("unchecked")
+ public void mediate(Object source,
+ Object target,
+ DataType sourceDataType,
+ DataType targetDataType,
+ Map<String, Object> metadata) {
+ if (source == null) {
+ // Shortcut for null value
+ return;
+ }
+ if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
+ sourceDataType = dataBindings.introspectType(source);
+ }
+ if (sourceDataType == null) {
+ return;
+ } else if (sourceDataType.equals(targetDataType)) {
+ return;
+ }
+
+ List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
+ Object result = source;
+ int size = path.size();
+ for (int i = 0; i < size; i++) {
+ Transformer transformer = path.get(i);
+ TransformationContext context = createTransformationContext(sourceDataType,
+ targetDataType,
+ size,
+ i,
+ transformer,
+ metadata);
+
+ if (transformer instanceof PullTransformer) {
+ result = ((PullTransformer)transformer).transform(result, context);
+ } else if (transformer instanceof PushTransformer) {
+ DataPipe dataPipe = (i < size - 1) ? (DataPipe)path.get(++i) : null;
+ Object sink = dataPipe != null ? dataPipe.getSink() : target;
+ ((PushTransformer)transformer).transform(result, sink, context);
+ result = (dataPipe != null) ? dataPipe.getResult() : null;
+ }
+ }
+ }
+
+ private List<Transformer> getTransformerChain(DataType sourceDataType, DataType targetDataType) {
+ String sourceId = sourceDataType.getDataBinding();
+ String targetId = targetDataType.getDataBinding();
+ List<Transformer> path = transformers.getTransformerChain(sourceId, targetId);
+ if (path == null) {
+ TransformationException ex = new TransformationException("No path found for the transformation");
+ ex.setSourceDataBinding(sourceId);
+ ex.setTargetDataBinding(targetId);
+ throw ex;
+ }
+ return path;
+ }
+
+ public DataBindingExtensionPoint getDataBindings() {
+ return dataBindings;
+ }
+
+ public TransformerExtensionPoint getTransformers() {
+ return transformers;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java
new file mode 100755
index 0000000000..9a1385f193
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.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.sca.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+
+/**
+ * A utility class to connect PushTransformer and DataPipe to create a
+ * PullTransformer
+ *
+ * @param <S> Source type
+ * @param <I> Intermidate type
+ * @param <R> Result type
+ */
+public class PipedTransformer<S, I, R> implements PullTransformer<S, R> {
+ private PushTransformer<S, I> pusher;
+
+ private DataPipe<I, R> pipe;
+
+ /**
+ * @param pumper
+ * @param pipe
+ */
+ public PipedTransformer(PushTransformer<S, I> pumper, DataPipe<I, R> pipe) {
+ super();
+ this.pusher = pumper;
+ this.pipe = pipe;
+ }
+
+ public R transform(S source, TransformationContext context) {
+ pusher.transform(source, pipe.getSink(), context);
+ return pipe.getResult();
+ }
+
+ public String getSourceDataBinding() {
+ return pusher.getSourceDataBinding();
+ }
+
+ public String getTargetDataBinding() {
+ return pipe.getTargetDataBinding();
+ }
+
+ public int getWeight() {
+ return pusher.getWeight() + pipe.getWeight();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
new file mode 100644
index 0000000000..009c7f2272
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.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.databinding.impl;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from a databinding's representation of simple
+ * types to Java Objects
+ */
+public abstract class SimpleType2JavaTransformer<T> extends BaseTransformer<T, Object> implements
+ PullTransformer<T, Object> {
+
+ protected SimpleTypeMapper mapper;
+
+ public SimpleType2JavaTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public SimpleType2JavaTransformer(SimpleTypeMapper mapper) {
+ this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
+ return mapper.toJavaObject(xmlType.getTypeName(), getText(source), context);
+ }
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+
+ public int getWeight() {
+ // Cannot be used for imtermediate
+ return 10000;
+ }
+
+ /**
+ * Get the string value from the source
+ * @param source
+ * @return A string
+ */
+ protected abstract String getText(T source);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
new file mode 100644
index 0000000000..9c23efe091
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
@@ -0,0 +1,392 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+
+public class SimpleTypeMapperImpl extends XSDDataTypeConverter implements SimpleTypeMapper {
+
+ public static final Map<Class, String> JAVA2XML = new HashMap<Class, String>();
+
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+
+ public static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
+
+ public static final QName XSD_ANY = new QName(URI_2001_SCHEMA_XSD, "any");
+
+ public static final QName XSD_ANYSIMPLETYPE = new QName(URI_2001_SCHEMA_XSD, "anySimpleType");
+
+ public static final QName XSD_ANYTYPE = new QName(URI_2001_SCHEMA_XSD, "anyType");
+
+ public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
+
+ public static final QName XSD_BASE64 = new QName(URI_2001_SCHEMA_XSD, "base64Binary");
+
+ public static final QName XSD_BOOLEAN = new QName(URI_2001_SCHEMA_XSD, "boolean");
+
+ public static final QName XSD_BYTE = new QName(URI_2001_SCHEMA_XSD, "byte");
+
+ public static final QName XSD_DATE = new QName(URI_2001_SCHEMA_XSD, "date");
+
+ public static final QName XSD_DATETIME = new QName(URI_2001_SCHEMA_XSD, "dateTime");
+
+ public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay");
+
+ public static final QName XSD_DECIMAL = new QName(URI_2001_SCHEMA_XSD, "decimal");
+
+ public static final QName XSD_DOUBLE = new QName(URI_2001_SCHEMA_XSD, "double");
+
+ public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration");
+
+ public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES");
+
+ public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY");
+
+ public static final QName XSD_FLOAT = new QName(URI_2001_SCHEMA_XSD, "float");
+
+ public static final QName XSD_HEXBIN = new QName(URI_2001_SCHEMA_XSD, "hexBinary");
+
+ public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF");
+
+ public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS");
+
+ public static final QName XSD_INT = new QName(URI_2001_SCHEMA_XSD, "int");
+
+ public static final QName XSD_INTEGER = new QName(URI_2001_SCHEMA_XSD, "integer");
+
+ public static final QName XSD_LONG = new QName(URI_2001_SCHEMA_XSD, "long");
+
+ public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth");
+
+ public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay");
+
+ public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name");
+
+ public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
+
+ public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger");
+
+ public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
+
+ public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
+
+ public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
+
+ public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
+
+ public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString");
+
+ public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION");
+
+ public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger");
+
+ public static final QName XSD_QNAME = new QName(URI_2001_SCHEMA_XSD, "QName");
+
+ public static final QName XSD_SHORT = new QName(URI_2001_SCHEMA_XSD, "short");
+
+ public static final Map<String, TypeInfo> XSD_SIMPLE_TYPES = new HashMap<String, TypeInfo>();
+
+ public static final QName XSD_STRING = new QName(URI_2001_SCHEMA_XSD, "string");
+
+ public static final QName XSD_TIME = new QName(URI_2001_SCHEMA_XSD, "time");
+
+ public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token");
+
+ public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte");
+
+ public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt");
+
+ public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong");
+
+ public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort");
+
+ public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear");
+
+ public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth");
+
+ private static final String[] XSD_TYPE_NAMES =
+ {"string", "boolean", "double", "float", "int", "integer", "long", "short", "byte", "decimal", "base64Binary",
+ "hexBinary", "anySimpleType", "anyType", "any", "QName", "dateTime", "date", "time", "normalizedString",
+ "token", "unsignedLong", "unsignedInt", "unsignedShort", "unsignedByte", "positiveInteger", "negativeInteger",
+ "nonNegativeInteger", "nonPositiveInteger", "gYearMonth", "gMonthDay", "gYear", "gMonth", "gDay", "duration",
+ "Name", "NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "ENTITY", "ENTITIES", "IDREF", "IDREFS", "anyURI",
+ "language", "ID"};
+
+ static {
+ for (String type : XSD_TYPE_NAMES) {
+ TypeInfo simpleType = new TypeInfo(new QName(URI_2001_SCHEMA_XSD, type), true, null);
+ XSD_SIMPLE_TYPES.put(type, simpleType);
+ }
+ }
+
+ static {
+ JAVA2XML.put(boolean.class, "boolean");
+ JAVA2XML.put(byte.class, "byte");
+ JAVA2XML.put(short.class, "short");
+ JAVA2XML.put(int.class, "int");
+ JAVA2XML.put(long.class, "long");
+ JAVA2XML.put(float.class, "float");
+ JAVA2XML.put(double.class, "double");
+ JAVA2XML.put(Boolean.class, "boolean");
+ JAVA2XML.put(Byte.class, "byte");
+ JAVA2XML.put(Short.class, "short");
+ JAVA2XML.put(Integer.class, "int");
+ JAVA2XML.put(Long.class, "long");
+ JAVA2XML.put(Float.class, "float");
+ JAVA2XML.put(Double.class, "double");
+ JAVA2XML.put(java.lang.String.class, "string");
+ JAVA2XML.put(java.math.BigInteger.class, "integer");
+ JAVA2XML.put(java.math.BigDecimal.class, "decimal");
+ JAVA2XML.put(java.util.Calendar.class, "dateTime");
+ JAVA2XML.put(java.util.Date.class, "dateTime");
+ JAVA2XML.put(javax.xml.namespace.QName.class, "QName");
+ JAVA2XML.put(java.net.URI.class, "string");
+ JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, "anySimpleType");
+ JAVA2XML.put(javax.xml.datatype.Duration.class, "duration");
+ JAVA2XML.put(java.lang.Object.class, "anyType");
+ JAVA2XML.put(java.awt.Image.class, "base64Binary");
+ JAVA2XML.put(byte[].class, "base64Binary");
+ // java2XSD.put(javax.activation.DataHandler.class, "base64Binary");
+ JAVA2XML.put(javax.xml.transform.Source.class, "base64Binary");
+ JAVA2XML.put(java.util.UUID.class, "string");
+ }
+
+ static {
+ XML2JAVA.put("string", java.lang.String.class);
+ XML2JAVA.put("integer", java.math.BigInteger.class);
+ XML2JAVA.put("int", int.class);
+ XML2JAVA.put("long", long.class);
+ XML2JAVA.put("short", short.class);
+ XML2JAVA.put("decimal", java.math.BigDecimal.class);
+ XML2JAVA.put("float", float.class);
+ XML2JAVA.put("double", double.class);
+ XML2JAVA.put("boolean", boolean.class);
+ XML2JAVA.put("byte", byte.class);
+ XML2JAVA.put("QName", javax.xml.namespace.QName.class);
+ XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("base64Binary", byte[].class);
+ XML2JAVA.put("hexBinary", byte[].class);
+ XML2JAVA.put("unsignedInt", long.class);
+ XML2JAVA.put("unsignedShort", int.class);
+ XML2JAVA.put("unsignedByte", short.class);
+ XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements
+ // XML2JAVA.put("anySimpleType", java.lang.String.class); // For
+ // attributes
+ XML2JAVA.put("duration", javax.xml.datatype.Duration.class);
+ XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class);
+ }
+
+ private DatatypeFactory factory;
+
+ public SimpleTypeMapperImpl() {
+ super();
+ try {
+ this.factory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public static Class getJavaType(QName xmlType) {
+ if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ public TypeInfo getXMLType(Class javaType) {
+ return XSD_SIMPLE_TYPES.get(JAVA2XML.get(javaType));
+ }
+
+ public Object toJavaObject(QName simpleType, String literal, TransformationContext context) {
+ /**
+ * <ul>
+ * <li>xsd:string --- java.lang.String
+ * <li>xsd:integer --- java.math.BigInteger
+ * <li>xsd:int --- int
+ * <li>xsd:long --- long
+ * <li>xsd:short --- short
+ * <li>xsd:decimal --- java.math.BigDecimal
+ * <li>xsd:float --- float
+ * <li>xsd:double --- double
+ * <li>xsd:boolean --- boolean
+ * <li>xsd:byte --- byte
+ * <li>xsd:QName --- javax.xml.namespace.QName
+ * <li>xsd:dateTime --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:base64Binary --- byte[]
+ * <li>xsd:hexBinary --- byte[]
+ * <li>xsd:unsignedInt --- long
+ * <li>xsd:unsignedShort --- int
+ * <li>xsd:unsignedByte --- short
+ * <li>xsd:time --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:date --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:g* --- javax.xml.datatype.XMLGregorianCalendar
+ * <li>xsd:anySimpleType (for xsd:element of this type)a
+ * java.lang.Object
+ * <li>xsd:anySimpleType (for xsd:attribute of this type)
+ * java.lang.String
+ * <li>xsd:duration javax.xml.datatype.Duration
+ * <li>xsd:NOTATION javax.xml.namespace.QName
+ * </ul>
+ */
+
+ if (literal == null) {
+ return null;
+ }
+ String value = literal.trim();
+
+ QName type = simpleType;
+ if (type.equals(XSD_STRING)) {
+ return parseString(value);
+ } else if (type.equals(XSD_INT)) {
+ return parseInt(value);
+ } else if (type.equals(XSD_INTEGER)) {
+ return parseInteger(value);
+ } else if (type.equals(XSD_INT)) {
+ return parseInt(value);
+ } else if (type.equals(XSD_FLOAT)) {
+ return parseFloat(value);
+ } else if (type.equals(XSD_DOUBLE)) {
+ return parseDouble(value);
+ } else if (type.equals(XSD_SHORT)) {
+ return parseShort(value);
+ } else if (type.equals(XSD_DECIMAL)) {
+ return parseDecimal(value);
+ } else if (type.equals(XSD_BOOLEAN)) {
+ return parseBoolean(value);
+ } else if (type.equals(XSD_BYTE)) {
+ return parseByte(value);
+ } else if (type.equals(XSD_LONG)) {
+ return parseLong(value);
+ } else if (type.equals(XSD_UNSIGNEDBYTE)) {
+ return parseUnsignedShort(value);
+ } else if (type.equals(XSD_UNSIGNEDSHORT)) {
+ return parseUnsignedShort(value);
+ } else if (type.equals(XSD_UNSIGNEDINT)) {
+ return parseUnsignedInt(value);
+ } else if (type.equals(XSD_UNSIGNEDLONG)) {
+ return parseUnsignedInt(value);
+ } else if (type.equals(XSD_DATETIME)) {
+ return parseDateTime(value);
+ } else if (type.equals(XSD_DATE)) {
+ return parseDate(value);
+ } else if (type.equals(XSD_TIME)) {
+ return parseTime(value);
+ } else if (type.equals(XSD_DURATION)) {
+ return parseDuration(value);
+ } else if (type.equals(XSD_HEXBIN)) {
+ return parseHexBinary(value);
+ } else if (type.equals(XSD_BASE64)) {
+ return parseBase64Binary(value);
+ } else if (type.equals(XSD_QNAME)) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
+ return parseQName(value, namespaceContext);
+ } else if (type.equals(XSD_NOTATION)) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
+ return parseQName(value, namespaceContext);
+ } else if (type.equals(XSD_YEAR)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_MONTH)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_DAY)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_YEARMONTH)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else if (type.equals(XSD_MONTHDAY)) {
+ return factory.newXMLGregorianCalendar(value);
+ } else {
+ return value;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private XMLGregorianCalendar toXMLGregorianCalendar(Date date) {
+ GregorianCalendar c =
+ new GregorianCalendar(date.getYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(),
+ date.getSeconds());
+ return factory.newXMLGregorianCalendar(c);
+ }
+
+ private XMLGregorianCalendar toXMLGregorianCalendar(GregorianCalendar calendar) {
+ return factory.newXMLGregorianCalendar(calendar);
+ }
+
+ public String toXMLLiteral(QName simpleType, Object obj, TransformationContext context) {
+ if (obj instanceof Float || obj instanceof Double) {
+ if (obj instanceof Float) {
+ return printDouble(((Float)obj).floatValue());
+ } else {
+ return printDouble(((Double)obj).doubleValue());
+ }
+ } else if (obj instanceof GregorianCalendar) {
+ GregorianCalendar calendar = (GregorianCalendar)obj;
+ return toXMLGregorianCalendar(calendar).toXMLFormat();
+ } else if (obj instanceof Date) {
+ return toXMLGregorianCalendar((Date)obj).toXMLFormat();
+ } else if (obj instanceof XMLGregorianCalendar) {
+ return ((XMLGregorianCalendar)obj).toXMLFormat();
+ } else if (obj instanceof byte[]) {
+ if (simpleType != null) {
+ if (simpleType.equals(XSD_BASE64)) {
+ return printBase64Binary((byte[])obj);
+ } else if (simpleType.equals(XSD_HEXBIN)) {
+ return printHexBinary((byte[])obj);
+ }
+ }
+ } else if (obj instanceof QName) {
+ NamespaceContext namespaceContext =
+ (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
+ return printQName((QName)obj, namespaceContext);
+ }
+ return obj.toString();
+ }
+
+ public static boolean isSimpleXSDType(QName typeName) {
+ if (typeName == null) {
+ return false;
+ }
+ return typeName.getNamespaceURI().equals(URI_2001_SCHEMA_XSD)
+ && XSD_SIMPLE_TYPES.get(typeName.getLocalPart()) != null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java
new file mode 100755
index 0000000000..6a11f4fcb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.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.databinding.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+public class TransformationContextImpl implements TransformationContext {
+ private DataType sourceDataType;
+
+ private DataType targetDataType;
+
+ private final Map<String, Object> metadata = new HashMap<String, Object>();
+
+ private WeakReference<ClassLoader> classLoaderRef;
+
+ public TransformationContextImpl() {
+ super();
+ setClassLoader(Thread.currentThread().getContextClassLoader());
+ }
+
+ public TransformationContextImpl(DataType sourceDataType,
+ DataType targetDataType,
+ ClassLoader classLoader,
+ Map<String, Object> metadata) {
+ super();
+ this.sourceDataType = sourceDataType;
+ this.targetDataType = targetDataType;
+ setClassLoader(classLoader);
+ if (metadata != null) {
+ this.metadata.putAll(metadata);
+ }
+ }
+
+ public DataType getSourceDataType() {
+ return sourceDataType;
+ }
+
+ public DataType getTargetDataType() {
+ return targetDataType;
+ }
+
+ public void setSourceDataType(DataType sourceDataType) {
+ this.sourceDataType = sourceDataType;
+ }
+
+ public void setTargetDataType(DataType targetDataType) {
+ this.targetDataType = targetDataType;
+ }
+
+ public final void setClassLoader(ClassLoader classLoader) {
+ this.classLoaderRef = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoaderRef.get();
+ }
+
+ public Map<String, Object> getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * @return the sourceOperation
+ */
+ public Operation getSourceOperation() {
+ return (Operation) metadata.get("source.operation");
+ }
+
+ /**
+ * @param sourceOperation the sourceOperation to set
+ */
+ public void setSourceOperation(Operation sourceOperation) {
+ this.metadata.put("source.operation", sourceOperation);
+ }
+
+ /**
+ * @return the targetOperation
+ */
+ public Operation getTargetOperation() {
+ return (Operation) metadata.get("target.operation");
+ }
+
+ /**
+ * @param targetOperation the targetOperation to set
+ */
+ public void setTargetOperation(Operation targetOperation) {
+ this.metadata.put("target.operation", targetOperation);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
new file mode 100644
index 0000000000..7c92c365cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
@@ -0,0 +1,941 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.impl;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.Writer;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.ParsePosition;
+import java.util.Calendar;
+import java.util.TimeZone;
+
+import javax.xml.XMLConstants;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+/**
+ * Utility class for XSD data type conversions
+ */
+public class XSDDataTypeConverter {
+ public static final class Base64Binary {
+ private static final char[] S_BASE64CHAR =
+ {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
+ 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
+ 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4',
+ '5', '6', '7', '8', '9', '+', '/'};
+
+ private static final char S_BASE64PAD = '=';
+
+ private static final byte[] S_DECODETABLE = new byte[128];
+
+ static {
+ for (int i = 0; i < S_DECODETABLE.length; i++) {
+ S_DECODETABLE[i] = Byte.MAX_VALUE; // 127
+ }
+ for (int i = 0; i < S_BASE64CHAR.length; i++) {
+ // 0 to 63
+ S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i;
+ }
+ }
+
+ private Base64Binary() {
+ }
+
+ /**
+ *
+ */
+ public static byte[] decode(char[] data, int off, int len) {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[len / 4 * 3 + 3];
+ int obufcount = 0;
+ for (int i = off; i < off + len; i++) {
+ char ch = data[i];
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ obufcount += decode0(ibuf, obuf, obufcount);
+ }
+ }
+ }
+ if (obufcount == obuf.length) {
+ return obuf;
+ }
+ byte[] ret = new byte[obufcount];
+ System.arraycopy(obuf, 0, ret, 0, obufcount);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[3];
+ for (int i = off; i < off + len; i++) {
+ char ch = data[i];
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ int obufcount = decode0(ibuf, obuf, 0);
+ ostream.write(obuf, 0, obufcount);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public static byte[] decode(String data) {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[data.length() / 4 * 3 + 3];
+ int obufcount = 0;
+ for (int i = 0; i < data.length(); i++) {
+ char ch = data.charAt(i);
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ obufcount += decode0(ibuf, obuf, obufcount);
+ }
+ }
+ }
+ if (obufcount == obuf.length) {
+ return obuf;
+ }
+ byte[] ret = new byte[obufcount];
+ System.arraycopy(obuf, 0, ret, 0, obufcount);
+ return ret;
+ }
+
+ /**
+ *
+ */
+ public static void decode(String data, OutputStream ostream) throws IOException {
+ char[] ibuf = new char[4];
+ int ibufcount = 0;
+ byte[] obuf = new byte[3];
+ for (int i = 0; i < data.length(); i++) {
+ char ch = data.charAt(i);
+ if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
+ ibuf[ibufcount++] = ch;
+ if (ibufcount == ibuf.length) {
+ ibufcount = 0;
+ int obufcount = decode0(ibuf, obuf, 0);
+ ostream.write(obuf, 0, obufcount);
+ }
+ }
+ }
+ }
+
+ private static int decode0(char[] ibuf, byte[] obuf, int index) {
+ int wp = index;
+ int outlen = 3;
+ if (ibuf[3] == S_BASE64PAD) {
+ outlen = 2;
+ }
+ if (ibuf[2] == S_BASE64PAD) {
+ outlen = 1;
+ }
+ int b0 = S_DECODETABLE[ibuf[0]];
+ int b1 = S_DECODETABLE[ibuf[1]];
+ int b2 = S_DECODETABLE[ibuf[2]];
+ int b3 = S_DECODETABLE[ibuf[3]];
+ switch (outlen) {
+ case 1:
+ obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ return 1;
+ case 2:
+ obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+ return 2;
+ case 3:
+ obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
+ obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
+ obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);
+ return 3;
+ default:
+ throw new IllegalArgumentException("The character sequence is not base64 encoded.");
+ }
+ }
+
+ /**
+ * Returns base64 representation of specified byte array.
+ */
+ public static String encode(byte[] data) {
+ return encode(data, 0, data.length);
+ }
+
+ /**
+ * Returns base64 representation of specified byte array.
+ */
+ public static String encode(byte[] data, int off, int len) {
+ if (len <= 0) {
+ return "";
+ }
+ char[] out = new char[len / 3 * 4 + 4];
+ int rindex = off;
+ int windex = 0;
+ int rest = len - off;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[windex++] = S_BASE64CHAR[i >> 18];
+ out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[windex++] = S_BASE64CHAR[i & 0x3f];
+ rindex += 3;
+ rest -= 3;
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[windex++] = S_BASE64CHAR[i >> 2];
+ out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f];
+ out[windex++] = S_BASE64PAD;
+ out[windex++] = S_BASE64PAD;
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[windex++] = S_BASE64CHAR[i >> 10];
+ out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f];
+ out[windex++] = S_BASE64PAD;
+ }
+ return new String(out, 0, windex);
+ }
+
+ /**
+ * Outputs base64 representation of the specified byte array to a byte stream.
+ */
+ public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException {
+ if (len <= 0) {
+ return;
+ }
+ byte[] out = new byte[4];
+ int rindex = off;
+ int rest = len - off;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[0] = (byte) S_BASE64CHAR[i >> 18];
+ out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[3] = (byte) S_BASE64CHAR[i & 0x3f];
+ ostream.write(out, 0, 4);
+ rindex += 3;
+ rest -= 3;
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[0] = (byte) S_BASE64CHAR[i >> 2];
+ out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f];
+ out[2] = (byte) S_BASE64PAD;
+ out[3] = (byte) S_BASE64PAD;
+ ostream.write(out, 0, 4);
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[0] = (byte) S_BASE64CHAR[i >> 10];
+ out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f];
+ out[3] = (byte) S_BASE64PAD;
+ ostream.write(out, 0, 4);
+ }
+ }
+
+ /**
+ * Outputs base64 representation of the specified byte array to a character stream.
+ */
+ public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
+ if (len <= 0) {
+ return;
+ }
+ char[] out = new char[4];
+ int rindex = off;
+ int rest = len - off;
+ int output = 0;
+ while (rest >= 3) {
+ int i =
+ ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
+ + (data[rindex + 2] & 0xff);
+ out[0] = S_BASE64CHAR[i >> 18];
+ out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];
+ out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];
+ out[3] = S_BASE64CHAR[i & 0x3f];
+ writer.write(out, 0, 4);
+ rindex += 3;
+ rest -= 3;
+ output += 4;
+ if (output % 76 == 0) {
+ writer.write("\n");
+ }
+ }
+ if (rest == 1) {
+ int i = data[rindex] & 0xff;
+ out[0] = S_BASE64CHAR[i >> 2];
+ out[1] = S_BASE64CHAR[(i << 4) & 0x3f];
+ out[2] = S_BASE64PAD;
+ out[3] = S_BASE64PAD;
+ writer.write(out, 0, 4);
+ } else if (rest == 2) {
+ int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
+ out[0] = S_BASE64CHAR[i >> 10];
+ out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];
+ out[2] = S_BASE64CHAR[(i << 2) & 0x3f];
+ out[3] = S_BASE64PAD;
+ writer.write(out, 0, 4);
+ }
+ }
+ }
+
+ /**
+ * <p/>
+ * Utility class for xs:hexbinary. </p>
+ */
+ public static final class HexBinary {
+ private HexBinary() {
+ }
+
+ /**
+ * Converts the string <code>pValue</code> into an array of hex bytes.
+ */
+ public static byte[] decode(String pValue) {
+ if ((pValue.length() % 2) != 0) {
+ throw new IllegalArgumentException("A HexBinary string must have even length.");
+ }
+ byte[] result = new byte[pValue.length() / 2];
+ int j = 0;
+ int i = 0;
+ while (i < pValue.length()) {
+ byte b;
+ char c = pValue.charAt(i++);
+ char d = pValue.charAt(i++);
+ if (c >= '0' && c <= '9') {
+ b = (byte) ((c - '0') << 4);
+ } else if (c >= 'A' && c <= 'F') {
+ b = (byte) ((c - 'A' + 10) << 4);
+ } else if (c >= 'a' && c <= 'f') {
+ b = (byte) ((c - 'a' + 10) << 4);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + c);
+ }
+ if (d >= '0' && d <= '9') {
+ b += (byte) (d - '0');
+ } else if (d >= 'A' && d <= 'F') {
+ b += (byte) (d - 'A' + 10);
+ } else if (d >= 'a' && d <= 'f') {
+ b += (byte) (d - 'a' + 10);
+ } else {
+ throw new IllegalArgumentException("Invalid hex digit: " + d);
+ }
+ result[j++] = b;
+ }
+ return result;
+ }
+
+ /**
+ * Converts the byte array <code>pHexBinary</code> into a string.
+ */
+ public static String encode(byte[] pHexBinary) {
+ StringBuffer result = new StringBuffer();
+ for (int i = 0; i < pHexBinary.length; i++) {
+ byte b = pHexBinary[i];
+ byte c = (byte) ((b & 0xf0) >> 4);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ c = (byte) (b & 0x0f);
+ if (c <= 9) {
+ result.append((char) ('0' + c));
+ } else {
+ result.append((char) ('A' + c - 10));
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * Creates a clone of the given byte array.
+ */
+ public static byte[] getClone(byte[] pHexBinary) {
+ byte[] result = new byte[pHexBinary.length];
+ System.arraycopy(pHexBinary, 0, result, 0, pHexBinary.length);
+ return result;
+ }
+ }
+
+ public class XSDDateFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = -1629412916827246627L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateFormat() {
+ super(true, false);
+ }
+ }
+
+ /**
+ * <p/>
+ * An instance of {@link java.text.Format}, which may be used to parse and format <code>xs:dateTime</code> values.
+ * </p>
+ */
+ public static class XSDDateTimeFormat extends Format {
+ private static final long serialVersionUID = -1148332471737068969L;
+
+ final boolean parseDate;
+
+ final boolean parseTime;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDDateTimeFormat() {
+ this(true, true);
+ }
+
+ XSDDateTimeFormat(boolean pParseDate, boolean pParseTime) {
+ parseDate = pParseDate;
+ parseTime = pParseTime;
+ }
+
+ private void append(StringBuffer pBuffer, int pNum, int pMinLen) {
+ String s = Integer.toString(pNum);
+ for (int i = s.length(); i < pMinLen; i++) {
+ pBuffer.append('0');
+ }
+ pBuffer.append(s);
+ }
+
+ public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
+ assert pCalendar != null : "The Calendar argument must not be null.";
+ assert pBuffer != null : "The StringBuffer argument must not be null.";
+ assert pPos != null : "The FieldPosition argument must not be null.";
+
+ Calendar cal = (Calendar) pCalendar;
+ if (parseDate) {
+ int year = cal.get(Calendar.YEAR);
+ if (year < 0) {
+ pBuffer.append('-');
+ year = -year;
+ }
+ append(pBuffer, year, 4);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.MONTH) + 1, 2);
+ pBuffer.append('-');
+ append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2);
+ if (parseTime) {
+ pBuffer.append('T');
+ }
+ }
+ if (parseTime) {
+ append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.MINUTE), 2);
+ pBuffer.append(':');
+ append(pBuffer, cal.get(Calendar.SECOND), 2);
+ int millis = cal.get(Calendar.MILLISECOND);
+ if (millis > 0) {
+ pBuffer.append('.');
+ append(pBuffer, millis, 3);
+ }
+ }
+ TimeZone tz = cal.getTimeZone();
+ // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
+ int offset = cal.get(Calendar.ZONE_OFFSET);
+ if (tz.inDaylightTime(cal.getTime())) {
+ offset += cal.get(Calendar.DST_OFFSET);
+ }
+ if (offset == 0) {
+ pBuffer.append('Z');
+ } else {
+ if (offset < 0) {
+ pBuffer.append('-');
+ offset = -offset;
+ } else {
+ pBuffer.append('+');
+ }
+ int minutes = offset / (60 * 1000);
+ int hours = minutes / 60;
+ minutes -= hours * 60;
+ append(pBuffer, hours, 2);
+ pBuffer.append(':');
+ append(pBuffer, minutes, 2);
+ }
+ return pBuffer;
+ }
+
+ private int parseInt(String pString, int offset, StringBuffer pDigits) {
+ int length = pString.length();
+ int pOffset = offset;
+ pDigits.setLength(0);
+ while (pOffset < length) {
+ char c = pString.charAt(pOffset);
+ if (Character.isDigit(c)) {
+ pDigits.append(c);
+ ++pOffset;
+ } else {
+ break;
+ }
+ }
+ return pOffset;
+ }
+
+ public Object parseObject(String pString, ParsePosition pParsePosition) {
+ assert pString != null : "The String argument must not be null.";
+ assert pParsePosition != null : "The ParsePosition argument must not be null.";
+ int offset = pParsePosition.getIndex();
+ int length = pString.length();
+
+ boolean isMinus = false;
+ StringBuffer digits = new StringBuffer();
+ int year = 0;
+ int month = 0;
+ int mday = 0;
+ if (parseDate) {
+ // Sign
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == '+') {
+ ++offset;
+ } else if (c == '-') {
+ ++offset;
+ isMinus = true;
+ }
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() < 4) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ year = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ month = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '-') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ mday = Integer.parseInt(digits.toString());
+
+ if (parseTime) {
+ if (offset < length && pString.charAt(offset) == 'T') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ }
+ } else {
+ year = month = mday = 0;
+ }
+
+ int hour = 0;
+ int minute = 0;
+ int second = 0;
+ int millis = 0;
+ if (parseTime) {
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ hour = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ minute = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == ':') {
+ ++offset;
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() != 2) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ second = Integer.parseInt(digits.toString());
+
+ if (offset < length && pString.charAt(offset) == '.') {
+ ++offset;
+ offset = parseInt(pString, offset, digits);
+ if (digits.length() > 0) {
+ millis = Integer.parseInt(digits.toString());
+ } else {
+ millis = 0;
+ }
+ } else {
+ millis = 0;
+ }
+ } else {
+ hour = minute = second = millis = 0;
+ }
+
+ digits.setLength(0);
+ digits.append("GMT");
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == 'Z') {
+ // Ignore UTC, it is the default
+ ++offset;
+ } else if (c == '+' || c == '-') {
+ digits.append(c);
+ ++offset;
+ for (int i = 0; i < 5; i++) {
+ if (offset >= length) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ c = pString.charAt(offset);
+ if ((i != 2 && Character.isDigit(c)) || (i == 2 && c == ':')) {
+ digits.append(c);
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ ++offset;
+ }
+ }
+ }
+
+ Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
+ cal.set(isMinus ? -year : year, parseDate ? month - 1 : month, mday, hour, minute, second);
+ cal.set(Calendar.MILLISECOND, millis);
+ pParsePosition.setIndex(offset);
+ return cal;
+ }
+ }
+
+ public static class XSDTimeFormat extends XSDDateTimeFormat {
+ private static final long serialVersionUID = 1346506860724640517L;
+
+ /**
+ * Creates a new instance.
+ */
+ public XSDTimeFormat() {
+ super(false, true);
+ }
+ }
+
+ private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1;
+
+ private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
+
+ public String parseAnySimpleType(String value) {
+ return value;
+ }
+
+ public byte[] parseBase64Binary(String value) {
+ return Base64Binary.decode(value);
+ }
+
+ public boolean parseBoolean(String value) {
+ return Boolean.valueOf(value).booleanValue();
+ }
+
+ public byte parseByte(String value) {
+ return Byte.parseByte(value);
+ }
+
+ public Calendar parseDate(String value) {
+ XSDDateFormat format = new XSDDateFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse date " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public Calendar parseDateTime(String value) {
+ XSDDateTimeFormat format = new XSDDateTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse dateTime " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public BigDecimal parseDecimal(String value) {
+ return new BigDecimal(value);
+ }
+
+ public double parseDouble(String value) {
+ if ("INF".equals(value)) {
+ return Double.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Double.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Double.NaN;
+ } else {
+ return Double.parseDouble(value);
+ }
+ }
+
+ public Duration parseDuration(String pDuration) {
+ try {
+ return DatatypeFactory.newInstance().newDuration(pDuration);
+ } catch (DatatypeConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public float parseFloat(String value) {
+ if ("INF".equals(value)) {
+ return Float.POSITIVE_INFINITY;
+ } else if ("-INF".equals(value)) {
+ return Float.NEGATIVE_INFINITY;
+ } else if ("NaN".equals(value)) {
+ return Float.NaN;
+ } else {
+ return Float.parseFloat(value);
+ }
+ }
+
+ public byte[] parseHexBinary(String value) {
+ return HexBinary.decode(value);
+ }
+
+ public int parseInt(String value) {
+ return Integer.parseInt(value);
+ }
+
+ public BigInteger parseInteger(String value) {
+ return new BigInteger(value);
+ }
+
+ public long parseLong(String value) {
+ return Long.parseLong(value);
+ }
+
+ public QName parseQName(String value, NamespaceContext context) {
+ int offset = value.indexOf(':');
+ String uri;
+ String localName;
+ switch (offset) {
+ case -1:
+ localName = value;
+ uri = context.getNamespaceURI("");
+ if (uri == null) {
+ // Should not happen, indicates an error in the
+ // NamespaceContext
+ // implementation
+ throw new IllegalArgumentException("The default prefix is not bound.");
+ }
+ break;
+ case 0:
+ throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: "
+ + value);
+ default:
+ String prefix = value.substring(0, offset);
+ localName = value.substring(offset + 1);
+ uri = context.getNamespaceURI(prefix);
+ if (uri == null) {
+ throw new IllegalArgumentException("The prefix " + prefix + " is not bound.");
+ }
+ }
+ return new QName(uri, localName);
+ }
+
+ public short parseShort(String value) {
+ return Short.parseShort(value);
+ }
+
+ public String parseString(String value) {
+ return value;
+ }
+
+ public Calendar parseTime(String value) {
+ XSDTimeFormat format = new XSDTimeFormat();
+ ParsePosition pos = new ParsePosition(0);
+ Calendar cal = (Calendar) format.parseObject(value, pos);
+ if (cal == null) {
+ throw new IllegalArgumentException("Failed to parse time " + value + " at:"
+ + value.substring(pos.getErrorIndex()));
+ }
+ return cal;
+ }
+
+ public long parseUnsignedInt(String value) {
+ long l = Long.parseLong(value);
+ if (l < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result is negative");
+ }
+ if (l > MAX_UNSIGNED_INT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
+ }
+ return l;
+ }
+
+ public int parseUnsignedShort(String value) {
+ int i = Integer.parseInt(value);
+ if (i < 0) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result is negative");
+ }
+ if (i > MAX_UNSIGNED_SHORT) {
+ throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
+ + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
+ }
+ return i;
+ }
+
+ public String printAnySimpleType(String value) {
+ return value;
+ }
+
+ public String printBase64Binary(byte[] value) {
+ return Base64Binary.encode(value);
+ }
+
+ public String printBoolean(boolean value) {
+ return (value ? Boolean.TRUE : Boolean.FALSE).toString();
+ }
+
+ public String printByte(byte value) {
+ return Byte.toString(value);
+ }
+
+ public String printDate(Calendar value) {
+ return new XSDDateFormat().format(value);
+ }
+
+ public String printDateTime(Calendar value) {
+ return new XSDDateTimeFormat().format(value);
+ }
+
+ public String printDecimal(BigDecimal value) {
+ return value.toString();
+ }
+
+ public String printDouble(double value) {
+ return Double.toString(value);
+ }
+
+ public String printDuration(Duration pDuration) {
+ return pDuration.toString();
+ }
+
+ public String printFloat(float value) {
+ return Float.toString(value);
+ }
+
+ public String printHexBinary(byte[] value) {
+ return HexBinary.encode(value);
+ }
+
+ public String printInt(int value) {
+ return Integer.toString(value);
+ }
+
+ public String printInteger(BigInteger value) {
+ return value.toString();
+ }
+
+ public String printLong(long value) {
+ return Long.toString(value);
+ }
+
+ public String printQName(QName value, NamespaceContext context) {
+ String prefix = context.getPrefix(value.getNamespaceURI());
+ if (prefix == null) {
+ throw new IllegalArgumentException("The namespace URI " + value.getNamespaceURI()
+ + " is not bound.");
+ } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
+ return value.getLocalPart();
+ } else {
+ return prefix + ":" + value.getLocalPart();
+ }
+ }
+
+ public String printShort(short value) {
+ return Short.toString(value);
+ }
+
+ public String printString(String value) {
+ return value;
+ }
+
+ public String printTime(Calendar value) {
+ return new XSDTimeFormat().format(value);
+ }
+
+ public String printUnsignedInt(long value) {
+ return Long.toString(value);
+ }
+
+ public String printUnsignedShort(int value) {
+ return Integer.toString(value);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java
new file mode 100644
index 0000000000..34ddc4d268
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.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.databinding.javabeans;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * Transformer to convert data from DOM Node to JavaBean
+ */
+public class DOMNode2JavaBeanTransformer extends XML2JavaBeanTransformer<Node> {
+
+ @Override
+ public Node getRootElement(Node element) throws XML2JavaMapperException {
+ if (element instanceof Document) {
+ return ((Document)element).getDocumentElement();
+ } else {
+ return element;
+ }
+
+ }
+
+ @Override
+ public List<Node> getChildElements(Node parent) throws XML2JavaMapperException {
+ NodeList nodeList = parent.getChildNodes();
+ List<Node> nodeArrayList = new ArrayList<Node>(nodeList.getLength());
+ for (int count = 0; count < nodeList.getLength(); ++count) {
+ nodeArrayList.add(nodeList.item(count));
+ }
+
+ return nodeArrayList;
+ }
+
+ @Override
+ public String getElementName(Node element) throws XML2JavaMapperException {
+ return element.getLocalName();
+ }
+
+ @Override
+ public String getText(Node element) throws XML2JavaMapperException {
+ if (element instanceof Document) {
+ element = ((Document)element).getDocumentElement();
+ }
+ return element.getTextContent();
+ }
+
+ @Override
+ public boolean isTextElement(Node element) throws XML2JavaMapperException {
+ return element.getNodeType() == Node.TEXT_NODE;
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java
new file mode 100644
index 0000000000..050c4288c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.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.sca.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This exception is used to encapsulate and rethrow exceptions that arise out
+ * of converting JavaBean objects to XML
+ */
+public class Java2XMLMapperException extends RuntimeException {
+ private static final long serialVersionUID = 6811924384399578686L;
+
+ private QName xmlElementName;
+ private String javaFieldName;
+ private Class javaType;
+
+ public Java2XMLMapperException(String message) {
+ super(message);
+ }
+
+ public Java2XMLMapperException(Throwable cause) {
+ super(cause);
+ }
+
+ public String getJavaFieldName() {
+ return javaFieldName;
+ }
+
+ public void setJavaFieldName(String javaFieldName) {
+ this.javaFieldName = javaFieldName;
+ }
+
+ public Class getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(Class javaType) {
+ this.javaType = javaType;
+ }
+
+ public QName getXmlElementName() {
+ return xmlElementName;
+ }
+
+ public void setXmlElementName(QName xmlElementName) {
+ this.xmlElementName = xmlElementName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java
new file mode 100644
index 0000000000..c363a36d95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.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.sca.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * Transformer to convert data from a JavaBean object to DOM Node
+ */
+public class JavaBean2DOMNodeTransformer extends JavaBean2XMLTransformer<Node> {
+
+ public static final String COLON = ":";
+ private Document factory;
+
+ public JavaBean2DOMNodeTransformer() {
+ super();
+ try {
+ factory = DOMHelper.newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new Java2XMLMapperException(e);
+ }
+ }
+
+ @Override
+ public void appendChild(Node parentElement, Node childElement) throws Java2XMLMapperException {
+ parentElement.appendChild(childElement);
+ }
+
+ @Override
+ public Node createElement(QName qName) throws Java2XMLMapperException {
+ String qualifedName =
+ (qName.getPrefix() == null || qName.getPrefix().length() <= 0) ? qName.getLocalPart()
+ : qName.getPrefix() + COLON + qName.getLocalPart();
+ return factory.createElementNS(qName.getNamespaceURI(), qualifedName);
+ }
+
+ @Override
+ public Node createText(String textData) throws Java2XMLMapperException {
+ return factory.createTextNode(textData);
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReader.java
new file mode 100644
index 0000000000..a41d853958
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReader.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.sca.databinding.javabeans;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.xml.BeanUtil;
+import org.apache.tuscany.sca.databinding.xml.XMLDocumentStreamReader;
+
+public class JavaBean2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
+ PullTransformer<Object, XMLStreamReader> {
+
+ public XMLStreamReader transform(Object source, TransformationContext context) {
+ try {
+ return new XMLDocumentStreamReader(BeanUtil.getXMLStreamReader(source));
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
new file mode 100644
index 0000000000..56910582c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.javabeans;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+
+/**
+ * Transformer to convert data from a JavaBean object to xml
+ */
+public abstract class JavaBean2XMLTransformer<T> extends BaseTransformer<Object, T> implements
+ PullTransformer<Object, T> {
+
+ public static final String GET = "get";
+ public static final String PREFIX = "n";
+ public static final String PERIOD = ".";
+ public static final String FWD_SLASH = "/";
+ public static final String HTTP = "http://";
+ private static int prefixCount = 1;
+
+ protected SimpleTypeMapperImpl mapper;
+
+ public JavaBean2XMLTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ public T transform(Object source, TransformationContext context) {
+
+ //FIXME See how/if we still need to get the metadata here
+ //QName rootElementName = (QName)context.getTargetDataType().getMetadata("RootElementName");
+ //if (rootElementName == null) {
+ QName rootElementName = new QName(resolveRootElementName(source.getClass()));
+ //}
+
+ T root = createElement(rootElementName);
+ appendChildElements(root,
+ resolveElementName(source.getClass()),
+ source.getClass(),
+ source,
+ context);
+ return root;
+ }
+
+ private void appendChildElements(T parent,
+ QName elementName,
+ Class javaType,
+ Object javaObject,
+ TransformationContext context) {
+ T element = null;
+ if (javaObject != null) {
+ if (javaType.isPrimitive() || isSimpleJavaType(javaObject)) {
+ appendChild(parent, createText(mapper.toXMLLiteral(null, javaObject, context)));
+ } else if (javaType.isArray()) {
+ boolean arrayDone = false;
+ Object arrayObject = null;
+ for (int count = 0; !arrayDone; ++count) {
+ try {
+ arrayObject = Array.get(javaObject, count);
+ element = createElement(elementName);
+ appendChild(parent, element);
+ appendChildElements(element,
+ elementName,
+ javaType.getComponentType(),
+ arrayObject,
+ context);
+ } catch (ArrayIndexOutOfBoundsException e1) {
+ arrayDone = true;
+ }
+ }
+ } else {
+ Field[] javaFields = javaType.getFields();
+ for (Field aField : javaFields) {
+ try {
+ QName fieldElementName = new QName(aField.getName());
+ if (!aField.getType().isArray()) {
+ element = createElement(fieldElementName);
+ appendChild(parent, element);
+ appendChildElements(element,
+ fieldElementName,
+ aField.getType(),
+ aField.get(javaObject),
+ context);
+ } else {
+ appendChildElements(parent,
+ fieldElementName,
+ aField.getType(),
+ aField.get(javaObject),
+ context);
+ }
+ } catch (IllegalAccessException e) {
+ Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
+ java2xmlEx.setJavaFieldName(aField.getName());
+ java2xmlEx.setJavaType(javaType);
+ throw java2xmlEx;
+ }
+ }
+
+ Method[] methods = javaType.getDeclaredMethods();
+ String fieldName = null;
+ for (Method aMethod : methods) {
+ try {
+ if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET)
+ && aMethod.getParameterTypes().length == 0) {
+ fieldName = resolveFieldFromMethod(aMethod.getName());
+ try {
+ javaType.getField(fieldName);
+ } catch (NoSuchFieldException e) {
+ QName fieldElementName = new QName(fieldName);
+ if (aMethod.getReturnType().isArray()) {
+ appendChildElements(parent, fieldElementName, aMethod.getReturnType(), aMethod
+ .invoke(javaObject, new Object[0]), context);
+ } else {
+ element = createElement(fieldElementName);
+ appendChild(parent, element);
+ appendChildElements(element, fieldElementName, aMethod.getReturnType(), aMethod
+ .invoke(javaObject, new Object[0]), context);
+ }
+ }
+ }
+ } catch (IllegalAccessException e) {
+ Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
+ java2xmlEx.setJavaFieldName(fieldName);
+ java2xmlEx.setJavaType(javaType);
+ throw java2xmlEx;
+ } catch (InvocationTargetException e) {
+ Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
+ java2xmlEx.setJavaFieldName(fieldName);
+ java2xmlEx.setJavaType(javaType);
+ throw java2xmlEx;
+ }
+ }
+ }
+ }
+ }
+
+ public Class getSourceType() {
+ return Object.class;
+ }
+
+ private boolean isSimpleJavaType(Object javaObject) {
+ if (javaObject instanceof String) {
+ return true;
+ }
+ if (javaObject instanceof Byte || javaObject instanceof Character
+ || javaObject instanceof Short
+ || javaObject instanceof Integer
+ || javaObject instanceof Long
+ || javaObject instanceof Float
+ || javaObject instanceof Double) {
+ return true;
+ }
+ if (javaObject instanceof GregorianCalendar || javaObject instanceof Date
+ || javaObject instanceof XMLGregorianCalendar
+ || javaObject instanceof byte[]
+ || javaObject instanceof QName) {
+ return true;
+ }
+ return false;
+ }
+
+ private String resolveRootElementName(Class javaType) {
+ if (javaType.isArray()) {
+ return javaType.getComponentType().getSimpleName() + "_collection";
+ } else {
+ return javaType.getSimpleName() + "_instance";
+ }
+ }
+
+
+ private QName resolveElementName(Class javaType) {
+ if (javaType.isArray()) {
+ return new QName(javaType.getComponentType().getSimpleName());
+ } else {
+ return new QName(javaType.getSimpleName());
+ }
+ }
+
+ private String resolveFieldFromMethod(String methodName) {
+ StringBuffer fieldName = new StringBuffer();
+ fieldName.append(Character.toLowerCase(methodName.charAt(GET.length())));
+ fieldName.append(methodName.substring(GET.length() + 1));
+ return fieldName.toString();
+ }
+
+ public String getNexPrefix() {
+ return PREFIX + prefixCount++;
+ }
+
+ @Override
+ public int getWeight() {
+ return JavaBeansDataBinding.HEAVY_WEIGHT;
+ }
+
+ public abstract T createElement(QName qName) throws Java2XMLMapperException;
+ public abstract T createText(String textData) throws Java2XMLMapperException;
+ public abstract void appendChild(T parentElement, T childElement) throws Java2XMLMapperException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
new file mode 100644
index 0000000000..966fc48bb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.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.sca.databinding.javabeans;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+import java.io.OutputStream;
+import java.io.Serializable;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+
+/**
+ * DataBinding for JavaBeans
+ */
+public class JavaBeansDataBinding extends BaseDataBinding {
+ /**
+ * Defining a weight to a very high number so that the transformer won't be picked
+ * up by other paths unless it's the only available path
+ */
+ public static final int HEAVY_WEIGHT = 10000;
+ public static final String NAME = Object.class.getName();
+
+ public JavaBeansDataBinding() {
+ super(NAME, Object.class);
+ }
+
+ public Object copy(Object arg) {
+ if (arg == null) {
+ return null;
+ }
+ final Class clazz = arg.getClass();
+ if (String.class == clazz || clazz.isPrimitive()
+ || Number.class.isAssignableFrom(clazz)
+ || Boolean.class.isAssignableFrom(clazz)
+ || Character.class.isAssignableFrom(clazz)
+ || Byte.class.isAssignableFrom(clazz)) {
+ // Immutable classes
+ return arg;
+ }
+ try {
+ if (arg instanceof Serializable) {
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = getObjectOutputStream(bos);
+ oos.writeObject(arg);
+ oos.close();
+ bos.close();
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+ ObjectInputStream ois = getObjectInputStream(bis, clazz.getClassLoader());
+ Object objectCopy = ois.readObject();
+ ois.close();
+ bis.close();
+ return objectCopy;
+ } else {
+ // return arg;
+ throw new IllegalArgumentException("Pass-by-value is not supported for the given object");
+ }
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Pass-by-value is not supported for the given object", e);
+ }
+ }
+
+ protected ObjectOutputStream getObjectOutputStream(OutputStream os) throws IOException {
+ return new ObjectOutputStream(os);
+ }
+
+ protected ObjectInputStream getObjectInputStream(InputStream is, final ClassLoader cl) throws IOException {
+ ObjectInputStream ois = new ObjectInputStream(is) {
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
+ try {
+ return Class.forName(desc.getName(), false, cl);
+ } catch (ClassNotFoundException e) {
+ return super.resolveClass(desc);
+ }
+ }
+
+ };
+ return ois;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
new file mode 100644
index 0000000000..2bf16a5b86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
@@ -0,0 +1,295 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.javabeans;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * Transformer to convert data from XML to JavaBean
+ */
+public abstract class XML2JavaBeanTransformer<T> extends BaseTransformer<T, Object> implements
+ PullTransformer<T, Object> {
+
+ public static final String SET = "set";
+
+ protected SimpleTypeMapperImpl mapper;
+
+ public XML2JavaBeanTransformer() {
+ this.mapper = new SimpleTypeMapperImpl();
+ }
+
+ @Override
+ public int getWeight() {
+ return JavaBeansDataBinding.HEAVY_WEIGHT;
+ }
+
+ public Object transform(T source, TransformationContext context) {
+ XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
+ return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
+ }
+
+ public Object toJavaObject(QName xmlType, T xmlElement, TransformationContext context) {
+ if (SimpleTypeMapperImpl.isSimpleXSDType(xmlType)) {
+ return mapper.toJavaObject(xmlType, getText(xmlElement), context);
+ } else {
+ Class<?> javaType = (Class<?>)context.getTargetDataType().getPhysical();
+ return createJavaObject(xmlElement, javaType, context);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private <L> L createJavaObject(T element, Class<L> javaType, TransformationContext context)
+ throws XML2JavaMapperException {
+ List<T> childElements = getChildElements(element);
+ if (childElements.size() == 1 && isTextElement(childElements.get(0))) {
+ return (L) mapper.toJavaObject(mapper.getXMLType(javaType).getQName(),
+ getText(childElements.get(0)),
+ context);
+ } else {
+ String fieldName = null;
+ try {
+ L javaInstance = javaType.newInstance();
+ Map<Field, List<Object>> arrayFields = new Hashtable<Field, List<Object>>();
+ Map<Method, List<Object>> arraySetters = new Hashtable<Method, List<Object>>();
+ for (int count = 0; count < childElements.size(); ++count) {
+ if (!isTextElement(childElements.get(count))) {
+ fieldName = getElementName(childElements.get(count));
+ try {
+ Field javaField = javaType.getField(fieldName);
+ setFieldValue(javaInstance,
+ javaField,
+ childElements.get(count),
+ arrayFields,
+ context);
+
+ } catch (NoSuchFieldException e1) {
+ setFieldValueUsingSetter(javaType,
+ javaInstance,
+ fieldName,
+ childElements.get(count),
+ arraySetters,
+ context);
+ }
+ }
+ }
+
+ setArrayValues(javaInstance, arrayFields, arraySetters);
+ return javaInstance;
+ } catch (Exception e2) {
+ XML2JavaMapperException xml2JavaEx = new XML2JavaMapperException(e2);
+ xml2JavaEx.setJavaType(javaType);
+ xml2JavaEx.setJavaFieldName(fieldName);
+ throw xml2JavaEx;
+ }
+ }
+ }
+
+ private void setFieldValue(Object javaInstance,
+ Field javaField,
+ T fieldValue,
+ Map<Field, List<Object>> arrayFields,
+ TransformationContext context) throws IllegalAccessException {
+ Class<?> javaFieldType = (Class<?>) javaField.getType();
+
+ if (javaFieldType.isArray()) {
+ Class<?> componentType = javaFieldType.getComponentType();
+ List<Object> fldValueArray = arrayFields.get(javaField);
+ if (fldValueArray == null) {
+ fldValueArray = new ArrayList<Object>();
+ arrayFields.put(javaField, fldValueArray);
+ }
+ fldValueArray.add(createJavaObject(fieldValue, componentType, context));
+ } else {
+ javaField.setAccessible(true);
+ javaField.set(javaInstance, createJavaObject(fieldValue, javaFieldType, context));
+ }
+ }
+
+ private void setFieldValueUsingSetter(Class javaType,
+ Object javaInstance,
+ String fieldName,
+ T fieldValue,
+ Map<Method, List<Object>> arraySetters,
+ TransformationContext context) throws IllegalAccessException,
+ InvocationTargetException {
+ char firstChar = Character.toUpperCase(fieldName.charAt(0));
+ StringBuilder methodName = new StringBuilder(SET + fieldName);
+ methodName.setCharAt(SET.length(), firstChar);
+ boolean methodNotFound = true;
+
+ for (int methodCount = 0; methodNotFound && methodCount < javaType.getMethods().length; ++methodCount) {
+ Method aMethod = javaType.getMethods()[methodCount];
+ if (aMethod.getName().equals(methodName.toString())
+ && aMethod.getParameterTypes().length == 1) {
+ Class<?> paramType = aMethod.getParameterTypes()[0];
+
+ if (paramType.isArray()) {
+ Class<?> componentType = paramType.getComponentType();
+ List<Object> setterValueArray = arraySetters.get(aMethod);
+ if (setterValueArray == null) {
+ setterValueArray = new ArrayList<Object>();
+ arraySetters.put(aMethod, setterValueArray);
+ }
+ setterValueArray.add(createJavaObject(fieldValue, componentType, context));
+ } else {
+ aMethod.invoke(javaInstance, new Object[] {createJavaObject(fieldValue,
+ paramType,
+ context)});
+ }
+ methodNotFound = false;
+ }
+ }
+
+ if (methodNotFound) {
+ XML2JavaMapperException xml2JavaEx =
+ new XML2JavaMapperException("No field or setter method to configure xml data");
+ xml2JavaEx.setJavaFieldName(fieldName);
+ xml2JavaEx.setJavaType(javaType);
+ throw xml2JavaEx;
+ }
+ }
+
+ private void setArrayValues(Object javaInstance,
+ Map<Field, List<Object>> arrayFields,
+ Map<Method, List<Object>> arraySetters) throws IllegalAccessException,
+ InvocationTargetException {
+ if (arrayFields.size() > 0) {
+ for (Field javaField : arrayFields.keySet()) {
+ javaField.setAccessible(true);
+
+ if (javaField.getType().getComponentType().isPrimitive()) {
+ javaField.set(javaInstance, createPrimitiveArray(javaField.getType()
+ .getComponentType(),
+ arrayFields.get(javaField)));
+ } else {
+ javaField.set(javaInstance,
+ createNonPrimitiveArray(javaField.getType().getComponentType(),
+ arrayFields.get(javaField)));
+ }
+ }
+ }
+
+ if (arraySetters.size() > 0) {
+ for (Method aMethod : arraySetters.keySet()) {
+ Class paramType = aMethod.getParameterTypes()[0];
+ if (paramType.getComponentType().isPrimitive()) {
+ aMethod.invoke(javaInstance,
+ new Object[] {createPrimitiveArray(paramType.getComponentType(),
+ arraySetters.get(aMethod))});
+ } else {
+ aMethod.invoke(javaInstance,
+ new Object[] {createNonPrimitiveArray(paramType.getComponentType(),
+ arraySetters.get(aMethod))});
+ }
+ }
+ }
+ }
+
+ private Object createNonPrimitiveArray(Class fieldType, List values) {
+ Object objectArray = Array.newInstance(fieldType, values.size());
+ for (int count = 0; count < values.size(); ++count) {
+ Array.set(objectArray, count, values.get(count));
+ }
+ return objectArray;
+ }
+
+ private Object createPrimitiveArray(Class fieldType, List values) {
+ if (fieldType.isPrimitive()) {
+ if (fieldType.getName().equals("int")) {
+ int[] primitiveValues = new int[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Integer) values.get(count)).intValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("float")) {
+ float[] primitiveValues = new float[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Float) values.get(count)).floatValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("boolean")) {
+ boolean[] primitiveValues = new boolean[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Boolean) values.get(count)).booleanValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("char")) {
+ char[] primitiveValues = new char[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Character) values.get(count)).charValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("byte")) {
+ byte[] primitiveValues = new byte[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Byte) values.get(count)).byteValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("short")) {
+ short[] primitiveValues = new short[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Short) values.get(count)).shortValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("long")) {
+ long[] primitiveValues = new long[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Long) values.get(count)).longValue();
+ }
+ return primitiveValues;
+ } else if (fieldType.getName().equals("double")) {
+ double[] primitiveValues = new double[values.size()];
+ for (int count = 0; count < values.size(); ++count) {
+ primitiveValues[count] = ((Double) values.get(count)).doubleValue();
+ }
+ return primitiveValues;
+ }
+ }
+ return values;
+ }
+
+ public abstract String getText(T source) throws XML2JavaMapperException;
+
+ public abstract List<T> getChildElements(T parent) throws XML2JavaMapperException;
+
+ public abstract String getElementName(T element) throws XML2JavaMapperException;
+
+ public abstract boolean isTextElement(T element) throws XML2JavaMapperException;
+
+ public abstract T getRootElement(T element) throws XML2JavaMapperException;
+
+ public Class getTargetType() {
+ return Object.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java
new file mode 100644
index 0000000000..b7dee262c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.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.sca.databinding.javabeans;
+
+import javax.xml.namespace.QName;
+
+/**
+ * This exception is used to encapsulate and rethrow exceptions that arise out
+ * of converting XML Data to Java Objects.
+ */
+public class XML2JavaMapperException extends RuntimeException {
+ private static final long serialVersionUID = 6596530102591630642L;
+
+ private QName xmlElementName;
+ private String javaFieldName;
+ private Class javaType;
+
+ public XML2JavaMapperException(String message) {
+ super(message);
+ }
+
+ public XML2JavaMapperException(Throwable cause) {
+ super(cause);
+ }
+
+ public QName getXmlElementName() {
+ return xmlElementName;
+ }
+
+ public void setXmlElementName(QName xmlElementName) {
+ this.xmlElementName = xmlElementName;
+ }
+
+ public String getJavaFieldName() {
+ return javaFieldName;
+ }
+
+ public void setJavaFieldName(String javaFieldName) {
+ this.javaFieldName = javaFieldName;
+ }
+
+ public Class getJavaType() {
+ return javaType;
+ }
+
+ public void setJavaType(Class javaType) {
+ this.javaType = javaType;
+ }
+
+ @Override
+ public String getMessage() {
+ return super.getMessage() + " <" + getJavaFieldName() + "> " + " in <" + getJavaType() + ">";
+ }
+
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanUtil.java
new file mode 100644
index 0000000000..3ada634375
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanUtil.java
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+
+public final class BeanUtil {
+ private static final Object[] NULL = (Object[])null;
+ private static int nsCount = 1;
+
+ private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
+
+ private BeanUtil() {
+ }
+
+ private static boolean isSimpleType(Class javaType) {
+ return MAPPER.getXMLType(javaType) != null;
+ }
+
+ private static String getStringValue(Object o) {
+ if (o == null) {
+ return null;
+ }
+ TypeInfo info = MAPPER.getXMLType(o.getClass());
+ if (info != null) {
+ return MAPPER.toXMLLiteral(info.getQName(), o, null);
+ } else {
+ return String.valueOf(o);
+ }
+ }
+
+ /**
+ * To Serilize Bean object this method is used, this will create an object
+ * array using given bean object
+ *
+ * @param beanObject
+ * @param beanName
+ */
+ public static XMLStreamReader getXMLStreamReader(Object beanObject, QName beanName) {
+ try {
+ ClassLoader cl = beanObject.getClass().getClassLoader();
+ if (cl == null) {
+ cl = ClassLoader.getSystemClassLoader();
+ }
+ String beanNS = beanName.getNamespaceURI();
+ String beanPrefix = beanName.getPrefix();
+ BeanInfo beanInfo = Introspector.getBeanInfo(beanObject.getClass());
+ PropertyDescriptor[] propDescs = beanInfo.getPropertyDescriptors();
+ Map<String, PropertyDescriptor> propertMap = new HashMap<String, PropertyDescriptor>();
+ for (int i = 0; i < propDescs.length; i++) {
+ PropertyDescriptor propDesc = propDescs[i];
+ propertMap.put(propDesc.getName(), propDesc);
+ }
+ List<String> properties = new ArrayList<String>(propertMap.keySet());
+ Collections.sort(properties);
+ List<NamedProperty> props = new ArrayList<NamedProperty>();
+ for (int i = 0; i < properties.size(); i++) {
+ String property = properties.get(i);
+ PropertyDescriptor propDesc = (PropertyDescriptor)propertMap.get(property);
+ if (propDesc == null) {
+ // JAM does bad thing so I need to add this
+ continue;
+ }
+ Class ptype = propDesc.getPropertyType();
+ if ("class".equals(property)) {
+ continue;
+ }
+ if (isSimpleType(ptype)) {
+ Object value = propDesc.getReadMethod().invoke(beanObject, NULL);
+ NamedProperty prop =
+ new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(value));
+ props.add(prop);
+ } else if (ptype.isArray()) {
+ if (isSimpleType(ptype.getComponentType())) {
+ Object value = propDesc.getReadMethod().invoke(beanObject, NULL);
+ if (value != null) {
+ int i1 = Array.getLength(value);
+ for (int j = 0; j < i1; j++) {
+ Object o = Array.get(value, j);
+ NamedProperty prop =
+ new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o));
+ props.add(prop);
+ }
+ } else {
+ NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value);
+ props.add(prop);
+ }
+
+ } else {
+ Object value[] = (Object[])propDesc.getReadMethod().invoke(beanObject, NULL);
+ if (value != null) {
+ for (int j = 0; j < value.length; j++) {
+ Object o = value[j];
+ NamedProperty prop =
+ new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o));
+ props.add(prop);
+ }
+ } else {
+ NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value);
+ props.add(prop);
+ }
+ }
+ } else if (Collection.class.isAssignableFrom(ptype)) {
+ Object value = propDesc.getReadMethod().invoke(beanObject, NULL);
+ Collection objList = (Collection)value;
+ if (objList != null && objList.size() > 0) {
+ // this was given error , when the array.size = 0
+ // and if the array contain simple type , then the
+ // ADBPullParser asked
+ // PullParser from That simpel type
+ for (Iterator j = objList.iterator(); j.hasNext();) {
+ Object o = j.next();
+ if (isSimpleType(o.getClass())) {
+ NamedProperty prop =
+ new NamedProperty(new QName(beanNS, property, beanPrefix), getStringValue(o));
+ props.add(prop);
+ } else {
+ NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), o);
+ props.add(prop);
+ }
+ }
+
+ } else {
+ NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value);
+ props.add(prop);
+ }
+ } else {
+ Object value = propDesc.getReadMethod().invoke(beanObject, NULL);
+ NamedProperty prop = new NamedProperty(new QName(beanNS, property, beanPrefix), value);
+ props.add(prop);
+ }
+ }
+ NamedProperty[] elements = new NamedProperty[props.size()];
+ props.toArray(elements);
+ return new XMLFragmentStreamReaderImpl(beanName, elements, null);
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * to get the pull parser for a given bean object , generate the wrpper
+ * element using class name
+ *
+ * @param beanObject
+ */
+ public static XMLStreamReader getXMLStreamReader(Object beanObject) {
+ String className = beanObject.getClass().getName();
+ if (className.indexOf(".") > 0) {
+ className = className.substring(className.lastIndexOf('.') + 1, className.length());
+ }
+ return getXMLStreamReader(beanObject, new QName(className));
+ }
+
+ /**
+ * increments the namespace counter and returns a new prefix
+ *
+ * @return unique prefix
+ */
+ public static String getUniquePrefix() {
+ return "s" + nsCount++;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
new file mode 100644
index 0000000000..605d769fda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.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.databinding.xml;
+
+
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.w3c.dom.Node;
+
+/**
+ * DOM DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class DOMDataBinding extends BaseDataBinding {
+ public static final String NAME = Node.class.getName();
+ public static final String[] ALIASES = new String[] {"dom"};
+
+ public DOMDataBinding() {
+ super(NAME, ALIASES, Node.class);
+ }
+
+ @Override
+ public WrapperHandler getWrapperHandler() {
+ return new DOMWrapperHandler();
+ }
+
+ public Object copy(Object source) {
+ if (Node.class.isAssignableFrom(source.getClass())) {
+ Node nodeSource = (Node) source;
+ return nodeSource.cloneNode(true);
+ }
+ return super.copy(source);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
new file mode 100644
index 0000000000..1bb6277934
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.WrapperHandler;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class DOMWrapperHandler implements WrapperHandler<Node> {
+
+ private Document document;
+
+ public DOMWrapperHandler() {
+ super();
+ try {
+ this.document = DOMHelper.newDocument();
+ } catch (ParserConfigurationException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Node create(ElementInfo element, TransformationContext context) {
+ QName name = element.getQName();
+ return DOMHelper.createElement(document, name);
+ }
+
+ public void setChild(Node wrapper, int i, ElementInfo childElement, Object value) {
+ Node node = (Node) value;
+ if (node.getNodeType() == Node.DOCUMENT_NODE) {
+ node = ((Document) node).getDocumentElement();
+ }
+ wrapper.appendChild(wrapper.getOwnerDocument().importNode(node, true));
+ }
+
+ public List getChildren(Node wrapper) {
+ assert wrapper != null;
+ if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
+ wrapper = ((Document) wrapper).getDocumentElement();
+ }
+ List<Node> elements = new ArrayList<Node>();
+ NodeList nodes = wrapper.getChildNodes();
+ for (int j = 0; j < nodes.getLength(); j++) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ elements.add(node);
+ }
+ }
+ return elements;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java
new file mode 100644
index 0000000000..e377dd1d8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.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.sca.databinding.xml;
+
+import static javax.xml.XMLConstants.DEFAULT_NS_PREFIX;
+import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class DOMXMLStreamReader extends XMLFragmentStreamReaderImpl {
+ private Element rootElement;
+
+ public DOMXMLStreamReader(Node node) {
+ super(null);
+ switch (node.getNodeType()) {
+ case Node.DOCUMENT_NODE:
+ this.rootElement = ((Document)node).getDocumentElement();
+ break;
+ case Node.ELEMENT_NODE:
+ this.rootElement = (Element)node;
+ break;
+ default:
+ throw new IllegalArgumentException("Illegal Node");
+ }
+ String ns = rootElement.getNamespaceURI();
+ String prefix = rootElement.getPrefix();
+ String name = rootElement.getLocalName();
+ elementQName = new QName(ns == null ? "" : ns, name, prefix == null ? "" : prefix);
+ }
+
+ @Override
+ protected final NamedProperty[] getAttributes() {
+ if (attributes == null) {
+ List<NamedProperty> attributeList = new ArrayList<NamedProperty>();
+ NamedNodeMap nodeMap = rootElement.getAttributes();
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String ns = attr.getNamespaceURI();
+ String prefix = attr.getPrefix();
+ if (!XMLNS_ATTRIBUTE_NS_URI.equals(ns)) {
+ QName attrName = new QName(ns == null ? "" : ns, attr.getLocalName(), prefix != null ? prefix : "");
+ NamedProperty pair = new NamedProperty(attrName, attr.getValue());
+ attributeList.add(pair);
+ }
+ }
+ attributes = new NamedProperty[attributeList.size()];
+ attributeList.toArray(attributes);
+ }
+ return attributes;
+ }
+
+ @Override
+ protected QName[] getNamespaces() {
+ List<QName> nsList = new ArrayList<QName>();
+ NamedNodeMap nodeMap = rootElement.getAttributes();
+ for (int i = 0; i < nodeMap.getLength(); i++) {
+ Attr attr = (Attr)nodeMap.item(i);
+ String ns = attr.getNamespaceURI();
+ if (XMLNS_ATTRIBUTE_NS_URI.equals(ns)) {
+ String prefix = attr.getPrefix();
+ if (prefix == null) {
+ // xmlns="http://ns"
+ nsList.add(new QName(attr.getValue(), "", DEFAULT_NS_PREFIX));
+ } else {
+ // xmlns:ns="http://ns"
+ nsList.add(new QName(attr.getValue(), "", attr.getLocalName()));
+ }
+ }
+ }
+ QName[] nss = new QName[nsList.size()];
+ nsList.toArray(nss);
+ return nss;
+ }
+
+ @Override
+ protected NamedProperty[] getElements() {
+ if (elements == null) {
+ List<NamedProperty> elementList = new ArrayList<NamedProperty>();
+ NodeList nodeList = rootElement.getChildNodes();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+ switch (node.getNodeType()) {
+ case Node.TEXT_NODE:
+ case Node.CDATA_SECTION_NODE:
+ NamedProperty pair = new NamedProperty(ELEMENT_TEXT, ((CharacterData)node).getData());
+ elementList.add(pair);
+ break;
+
+ case Node.ELEMENT_NODE:
+ Element element = (Element)node;
+ QName elementName = new QName(element.getNamespaceURI(), element.getLocalName());
+ pair = new NamedProperty(elementName, new DOMXMLStreamReader(element));
+ elementList.add(pair);
+ break;
+ }
+ }
+ elements = new NamedProperty[elementList.size()];
+ elementList.toArray(elements);
+ }
+ return elements;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
new file mode 100644
index 0000000000..2f63f932ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
@@ -0,0 +1,310 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.NamespaceContext;
+
+public class DelegatingNamespaceContext implements NamespaceContext {
+ private static int count;
+
+ private class WrappingIterator implements Iterator {
+
+ private Iterator containedIterator;
+
+ public WrappingIterator(Iterator containedIterator) {
+ this.containedIterator = containedIterator;
+ }
+
+ public Iterator getContainedIterator() {
+ return containedIterator;
+ }
+
+ public boolean hasNext() {
+ return containedIterator.hasNext();
+ }
+
+ public Object next() {
+ return containedIterator.next();
+ }
+
+ /**
+ * As per the contract on the API of Namespace context the returned iterator should be immutable
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ public void setContainedIterator(Iterator containedIterator) {
+ this.containedIterator = containedIterator;
+ }
+ }
+
+ private NamespaceContext parentNsContext;
+
+ private FastStack<String> prefixStack = new FastStack<String>();
+
+ // Keep two arraylists for the prefixes and namespaces. They should be in
+ // sync
+ // since the index of the entry will be used to relate them
+ // use the minimum initial capacity to let things handle memory better
+
+ private FastStack<String> uriStack = new FastStack<String>();
+
+ /**
+ * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
+ *
+ * @return string
+ */
+ public String generateUniquePrefix() {
+ String prefix = "p" + count++;
+ // null should be returned if the prefix is not bound!
+ while (getNamespaceURI(prefix) != null) {
+ prefix = "p" + count++;
+ }
+
+ return prefix;
+ }
+
+ public String getNamespaceURI(String prefix) {
+ // do the corrections as per the javadoc
+ int index = prefixStack.search(prefix);
+ if (index != -1) {
+ return (String)uriStack.get(index);
+ }
+ if (parentNsContext != null) {
+ return parentNsContext.getPrefix(prefix);
+ }
+ return null;
+ }
+
+ public NamespaceContext getParentNsContext() {
+ return parentNsContext;
+ }
+
+ public String getPrefix(String uri) {
+ // do the corrections as per the javadoc
+ int index = uriStack.search(uri);
+ if (index != -1) {
+ return (String)prefixStack.get(index);
+ }
+
+ if (parentNsContext != null) {
+ return parentNsContext.getPrefix(uri);
+ }
+ return null;
+ }
+
+ public Iterator getPrefixes(String uri) {
+ // create an arraylist that contains the relevant prefixes
+ String[] uris = (String[])uriStack.toArray(new String[uriStack.size()]);
+ List<String> tempList = new ArrayList<String>();
+ for (int i = uris.length - 1; i >= 0; i--) {
+ if (uris[i].equals(uri)) {
+ tempList.add(prefixStack.get(i));
+ // we assume that array conversion preserves the order
+ }
+ }
+ // by now all the relevant prefixes are collected
+ // make a new iterator and provide a wrapper iterator to
+ // obey the contract on the API
+ return new WrappingIterator(tempList.iterator());
+ }
+
+ /**
+ * Pop a namespace
+ */
+ public void popNamespace() {
+ prefixStack.pop();
+ uriStack.pop();
+ }
+
+ /**
+ * Register a namespace in this context
+ *
+ * @param prefix
+ * @param uri
+ */
+ public void pushNamespace(String prefix, String uri) {
+ prefixStack.push(prefix);
+ uriStack.push(uri);
+
+ }
+
+ public void setParentNsContext(NamespaceContext parentNsContext) {
+ this.parentNsContext = parentNsContext;
+ }
+
+ /**
+ * An implementation of the {@link java.util.Stack} API that is based on an <code>ArrayList</code> instead of a
+ * <code>Vector</code>, so it is not synchronized to protect against multi-threaded access. The implementation is
+ * therefore operates faster in environments where you do not need to worry about multiple thread contention.
+ * <p>
+ * The removal order of an <code>ArrayStack</code> is based on insertion order: The most recently added element is
+ * removed first. The iteration order is <i>not</i> the same as the removal order. The iterator returns elements
+ * from the bottom up, whereas the {@link #remove()} method removes them from the top down.
+ * <p>
+ * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
+ */
+ public static class FastStack<T> extends ArrayList<T> {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 2130079159931574599L;
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code>. The initial size is controlled by <code>ArrayList</code>
+ * and is currently 10.
+ */
+ public FastStack() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code> with an initial size.
+ *
+ * @param initialSize the initial size to use
+ * @throws IllegalArgumentException if the specified initial size is negative
+ */
+ public FastStack(int initialSize) {
+ super(initialSize);
+ }
+
+ /**
+ * Return <code>true</code> if this stack is currently empty.
+ * <p>
+ * This method exists for compatibility with <code>java.util.Stack</code>. New users of this class should use
+ * <code>isEmpty</code> instead.
+ *
+ * @return true if the stack is currently empty
+ */
+ public boolean empty() {
+ return isEmpty();
+ }
+
+ /**
+ * Returns the top item off of this stack without removing it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T peek() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(n - 1);
+ }
+ }
+
+ /**
+ * Returns the n'th item down (zero-relative) from the top of this stack without removing it.
+ *
+ * @param n the number of items down to go
+ * @return the n'th item on the stack, zero relative
+ * @throws EmptyStackException if there are not enough items on the stack to satisfy this request
+ */
+ public T peek(int n) throws EmptyStackException {
+ int m = (size() - n) - 1;
+ if (m < 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(m);
+ }
+ }
+
+ /**
+ * Pops the top item off of this stack and return it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T pop() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return remove(n - 1);
+ }
+ }
+
+ /**
+ * Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling
+ * <code>add</code>.
+ *
+ * @param item the item to be added
+ * @return the item just pushed
+ */
+ public Object push(T item) {
+ add(item);
+ return item;
+ }
+
+ /**
+ * Returns the top-most index for the object in the stack
+ *
+ * @param object the object to be searched for
+ * @return top-most index, or -1 if not found
+ */
+ public int search(T object) {
+ int i = size() - 1; // Current index
+ while (i >= 0) {
+ T current = get(i);
+ if ((object == null && current == null) || (object != null && object.equals(current))) {
+ return i;
+ }
+ i--;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the element on the top of the stack.
+ *
+ * @return the element on the top of the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T get() {
+ int size = size();
+ if (size == 0) {
+ throw new EmptyStackException();
+ }
+ return get(size - 1);
+ }
+
+ /**
+ * Removes the element on the top of the stack.
+ *
+ * @return the removed element
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T remove() {
+ int size = size();
+ if (size == 0) {
+ throw new EmptyStackException();
+ }
+ return remove(size - 1);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
new file mode 100644
index 0000000000..2d85d9bfb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.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.databinding.xml;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Push DOM InputSource to Node
+ */
+public class InputSource2Node extends BaseTransformer<InputSource, Node> implements
+ PullTransformer<InputSource, Node> {
+ private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+
+ public Node transform(InputSource source, TransformationContext context) {
+ try {
+ Source streamSource = new StreamSource(source.getCharacterStream());
+ DOMResult result = new DOMResult();
+ TRANSFORMER.transform(streamSource, result, context);
+ return result.getNode();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return InputSource.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
new file mode 100644
index 0000000000..a652114977
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.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.databinding.xml;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Push InputSource to SAX
+ */
+public class InputSource2SAX extends BaseTransformer<InputSource, ContentHandler> implements
+ PushTransformer<InputSource, ContentHandler> {
+
+ public void transform(InputSource source, ContentHandler target, TransformationContext context) {
+ try {
+ XMLReader reader = XMLReaderFactory.createXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+ reader.setContentHandler(target);
+ reader.parse(source);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return InputSource.class;
+ }
+
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
new file mode 100644
index 0000000000..4a0a697c5c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.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.databinding.xml;
+
+import java.io.InputStream;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/**
+ * Push DOM InputSource to Node
+ */
+public class InputStream2Node extends BaseTransformer<InputStream, Node> implements
+ PullTransformer<InputStream, Node> {
+ private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+
+ public Node transform(InputStream source, TransformationContext context) {
+ try {
+ Source streamSource = new SAXSource(new InputSource(source));
+ DOMResult result = new DOMResult();
+ TRANSFORMER.transform(streamSource, result, context);
+ return result.getNode();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return InputStream.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
new file mode 100644
index 0000000000..e3af07d707
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.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 org.apache.tuscany.sca.databinding.xml;
+
+import java.io.InputStream;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Push InputStream to SAX
+ */
+public class InputStream2SAX extends BaseTransformer<InputStream, ContentHandler> implements
+ PushTransformer<InputStream, ContentHandler> {
+ public void transform(InputStream source, ContentHandler target, TransformationContext context) {
+ try {
+ XMLReader reader = XMLReaderFactory.createXMLReader();
+ reader.setContentHandler(target);
+ reader.parse(new InputSource(source));
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return InputStream.class;
+ }
+
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
new file mode 100644
index 0000000000..157a95025d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
@@ -0,0 +1,403 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+
+public class NameValueArrayStreamReader implements XMLFragmentStreamReader {
+
+ private static final int START_ELEMENT_STATE = 0;
+ private static final int TEXT_STATE = 1;
+ private static final int END_ELEMENT_STATE = 2;
+ private static final int FINAL_END_ELEMENT_STATE = 3;
+ private static final int START_ELEMENT_STATE_WITH_NULL = 4;
+
+ private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
+ // the index of the array
+ private int arrayIndex;
+
+ private QName name;
+ private String[] values;
+
+ // start element is the default state
+ private int state = START_ELEMENT_STATE;
+
+ public NameValueArrayStreamReader(QName name, String[] values) {
+ this.name = name;
+ this.values = values;
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ this.namespaceContext.setParentNsContext(nsContext);
+ }
+
+ public void init() {
+ // todo what if the Qname namespace has not been declared
+ }
+
+ public Object getProperty(String string) throws IllegalArgumentException {
+ return null;
+ }
+
+ /**
+ * @throws XMLStreamException
+ */
+ public int next() throws XMLStreamException {
+ switch (state) {
+ case START_ELEMENT_STATE:
+ if (values.length > 0) {
+ state = TEXT_STATE;
+ return CHARACTERS;
+ } else {
+ state = FINAL_END_ELEMENT_STATE;
+ return END_ELEMENT;
+ }
+
+ case START_ELEMENT_STATE_WITH_NULL:
+ if (arrayIndex == (values.length - 1)) {
+ state = FINAL_END_ELEMENT_STATE;
+ } else {
+ state = END_ELEMENT_STATE;
+ }
+ return END_ELEMENT;
+ case FINAL_END_ELEMENT_STATE:
+ // oops, not supposed to happen!
+ throw new XMLStreamException("end already reached!");
+ case END_ELEMENT_STATE:
+ // we've to have more values since this is not the
+ // last value
+ // increment the counter
+ arrayIndex++;
+ if (values[arrayIndex] == null) {
+ state = START_ELEMENT_STATE_WITH_NULL;
+ } else {
+ state = START_ELEMENT_STATE;
+ }
+ return START_ELEMENT;
+ case TEXT_STATE:
+ if (arrayIndex == (values.length - 1)) {
+ state = FINAL_END_ELEMENT_STATE;
+ return END_ELEMENT;
+ } else {
+ state = END_ELEMENT_STATE;
+ return END_ELEMENT;
+ }
+
+ default:
+ throw new XMLStreamException("unknown event type!");
+ }
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ // nothing done here
+ }
+
+ public String getElementText() throws XMLStreamException {
+ return null; // not implemented
+ }
+
+ public int nextTag() throws XMLStreamException {
+ return 0; // not implemented
+ }
+
+ public String getAttributeValue(String string, String string1) {
+ if (state == TEXT_STATE) {
+ // todo something
+ return null;
+ } else {
+ return null;
+ }
+
+ }
+
+ public int getAttributeCount() {
+ if (state == START_ELEMENT_STATE_WITH_NULL) {
+ return 1;
+ }
+ if (state == START_ELEMENT_STATE) {
+ return 0;
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public QName getAttributeName(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
+ return NIL_QNAME;
+ }
+ if (state == START_ELEMENT_STATE) {
+ return null;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
+ return NIL_QNAME.getNamespaceURI();
+ }
+ if (state == START_ELEMENT_STATE) {
+ return null;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
+ return NIL_QNAME.getLocalPart();
+ }
+ if (state == START_ELEMENT_STATE) {
+ return null;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
+ return NIL_QNAME.getPrefix();
+ }
+ if (state == START_ELEMENT_STATE) {
+ return null;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeType(int i) {
+ return null; // not implemented
+ }
+
+ public String getAttributeValue(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
+ return NIL_VALUE_TRUE;
+ }
+ if (state == START_ELEMENT_STATE) {
+ return null;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return false; // not supported
+ }
+
+ public int getNamespaceCount() {
+ if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent()) {
+ return 1;
+ } else {
+ return 0;
+ }
+
+ }
+
+ public String getNamespacePrefix(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) {
+ return NIL_QNAME.getPrefix();
+ } else {
+ return null;
+ }
+ }
+
+ public String getNamespaceURI(int i) {
+ if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) {
+ return NIL_QNAME.getNamespaceURI();
+ } else {
+ return null;
+ }
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return this.namespaceContext;
+ }
+
+ public boolean isDone() {
+ return state == FINAL_END_ELEMENT_STATE;
+ }
+
+ public int getEventType() {
+ switch (state) {
+ case START_ELEMENT_STATE:
+ return START_ELEMENT;
+ case END_ELEMENT_STATE:
+ return END_ELEMENT;
+ case TEXT_STATE:
+ return CHARACTERS;
+ case FINAL_END_ELEMENT_STATE:
+ return END_ELEMENT;
+ default:
+ throw new UnsupportedOperationException();
+ // we've no idea what this is!!!!!
+ }
+
+ }
+
+ public String getText() {
+ if (state == TEXT_STATE) {
+ return values[arrayIndex];
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (state == TEXT_STATE) {
+ return values[arrayIndex].toCharArray();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ // not implemented
+ throw new UnsupportedOperationException();
+ }
+
+ public int getTextStart() {
+ if (state == TEXT_STATE) {
+ return 0;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (state == TEXT_STATE) {
+ return values[arrayIndex].length();
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getEncoding() {
+ return null;
+ }
+
+ public boolean hasText() {
+ return state == TEXT_STATE;
+ }
+
+ public Location getLocation() {
+ return null; // not supported
+ }
+
+ public QName getName() {
+ if (state != TEXT_STATE) {
+ return name;
+ } else {
+ return null;
+ }
+ }
+
+ public String getLocalName() {
+ if (state != TEXT_STATE) {
+ return name.getLocalPart();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasName() {
+ return state != TEXT_STATE;
+
+ }
+
+ public String getNamespaceURI() {
+ if (state != TEXT_STATE) {
+ return name.getNamespaceURI();
+ } else {
+ return null;
+ }
+
+ }
+
+ public String getPrefix() {
+ if (state != TEXT_STATE) {
+ return name.getPrefix();
+ } else {
+ return null;
+ }
+ }
+
+ public String getVersion() {
+ return null; // todo 1.0 ?
+ }
+
+ public boolean isStandalone() {
+ return false;
+ }
+
+ public boolean standaloneSet() {
+ return false;
+ }
+
+ public String getCharacterEncodingScheme() {
+ return null;
+ }
+
+ public String getPITarget() {
+ return null;
+ }
+
+ public String getPIData() {
+ return null;
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return state != FINAL_END_ELEMENT_STATE;
+ }
+
+ public void close() throws XMLStreamException {
+ // Do nothing - we've nothing to free here
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return namespaceContext.getNamespaceURI(prefix);
+ }
+
+ public boolean isStartElement() {
+ return state == START_ELEMENT_STATE;
+ }
+
+ public boolean isEndElement() {
+ return state == END_ELEMENT_STATE;
+ }
+
+ public boolean isCharacters() {
+ return state == TEXT_STATE;
+ }
+
+ public boolean isWhiteSpace() {
+ return false; // no whitespaces here
+ }
+
+ /**
+ * Test whether the xsi namespace is present
+ */
+ private boolean isXsiNamespacePresent() {
+ return namespaceContext.getNamespaceURI(NIL_QNAME.getPrefix()) != null;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
new file mode 100644
index 0000000000..71af7519e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.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.sca.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+
+
+public class NameValuePairStreamReader implements XMLFragmentStreamReader {
+
+ private static final int START_ELEMENT_STATE = 0;
+ private static final int TEXT_STATE = 1;
+ private static final int END_ELEMENT_STATE = 2;
+
+ private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
+
+ private QName name;
+ private String value;
+
+ private int state = START_ELEMENT_STATE;
+ // initiate at the start element state
+
+ // keeps track whether the namespace is declared
+ // false by default
+ private boolean nsDeclared;
+
+ public NameValuePairStreamReader(QName name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public Object getProperty(String key) throws IllegalArgumentException {
+ return null;
+ }
+
+ public int next() throws XMLStreamException {
+ // no need to handle null here. it should have been handled
+ // already
+ switch (state) {
+ case START_ELEMENT_STATE:
+ state = TEXT_STATE;
+ return CHARACTERS;
+ case END_ELEMENT_STATE:
+ // oops, not supposed to happen!
+ throw new XMLStreamException("end already reached!");
+ case TEXT_STATE:
+ state = END_ELEMENT_STATE;
+ return END_ELEMENT;
+ default:
+ throw new XMLStreamException("unknown event type!");
+ }
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ // not implemented
+ }
+
+ public String getElementText() throws XMLStreamException {
+ if (state == START_ELEMENT) {
+ // move to the end state and return the value
+ state = END_ELEMENT_STATE;
+ return value;
+ } else {
+ throw new XMLStreamException();
+ }
+
+ }
+
+ public int nextTag() throws XMLStreamException {
+ return 0; // todo
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return state != END_ELEMENT_STATE;
+ }
+
+ public void close() throws XMLStreamException {
+ // Do nothing - we've nothing to free here
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return namespaceContext.getNamespaceURI(prefix);
+ }
+
+ public boolean isStartElement() {
+ return state == START_ELEMENT_STATE;
+ }
+
+ public boolean isEndElement() {
+ return state == END_ELEMENT_STATE;
+ }
+
+ public boolean isCharacters() {
+ return state == TEXT_STATE;
+ }
+
+ public boolean isWhiteSpace() {
+ return false; // no whitespaces here
+ }
+
+ public String getAttributeValue(String string, String string1) {
+ return null;
+ }
+
+ public int getAttributeCount() {
+ return 0;
+ }
+
+ public QName getAttributeName(int i) {
+ return null;
+ }
+
+ public String getAttributeNamespace(int i) {
+ return null;
+ }
+
+ public String getAttributeLocalName(int i) {
+ return null;
+ }
+
+ public String getAttributePrefix(int i) {
+ return null;
+ }
+
+ public String getAttributeType(int i) {
+ return null;
+ }
+
+ public String getAttributeValue(int i) {
+ return null;
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return false; // no attribs here
+ }
+
+ public int getNamespaceCount() {
+ return nsDeclared ? 1 : 0;
+ }
+
+ public String getNamespacePrefix(int i) {
+ return (nsDeclared && i == 0) ? name.getPrefix() : null;
+ }
+
+ public String getNamespaceURI(int i) {
+ return (nsDeclared && i == 0) ? name.getNamespaceURI() : null;
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return this.namespaceContext;
+ }
+
+ public int getEventType() {
+ switch (state) {
+ case START_ELEMENT_STATE:
+ return START_ELEMENT;
+ case END_ELEMENT_STATE:
+ return END_ELEMENT;
+ case TEXT_STATE:
+ return CHARACTERS;
+ default:
+ throw new UnsupportedOperationException();
+ // we've no idea what this is!!!!!
+ }
+
+ }
+
+ public String getText() {
+ if (state == TEXT_STATE) {
+ return value;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (state == TEXT_STATE) {
+ return value.toCharArray();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ // not implemented
+ throw new UnsupportedOperationException();
+ }
+
+ public int getTextStart() {
+ if (state == TEXT_STATE) {
+ return 0;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (state == TEXT_STATE) {
+ return value.length();
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getEncoding() {
+ return null;
+ }
+
+ public boolean hasText() {
+ return state == TEXT_STATE;
+ }
+
+ public Location getLocation() {
+ return new Location() {
+ public int getLineNumber() {
+ return 0;
+ }
+
+ public int getColumnNumber() {
+ return 0;
+ }
+
+ public int getCharacterOffset() {
+ return 0;
+ }
+
+ public String getPublicId() {
+ return null;
+ }
+
+ public String getSystemId() {
+ return null;
+ }
+ };
+ }
+
+ public QName getName() {
+ if (state != TEXT_STATE) {
+ return name;
+ } else {
+ return null;
+ }
+ }
+
+ public String getLocalName() {
+ if (state != TEXT_STATE) {
+ return name.getLocalPart();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasName() {
+ return state != TEXT_STATE;
+
+ }
+
+ public String getNamespaceURI() {
+ if (state != TEXT_STATE) {
+ return name.getNamespaceURI();
+ } else {
+ return null;
+ }
+
+ }
+
+ public String getPrefix() {
+ if (state != TEXT_STATE) {
+ return name.getPrefix();
+ } else {
+ return null;
+ }
+ }
+
+ public String getVersion() {
+ return null; // todo 1.0 ?
+ }
+
+ public boolean isStandalone() {
+ return false;
+ }
+
+ public boolean standaloneSet() {
+ return false;
+ }
+
+ public String getCharacterEncodingScheme() {
+ return null;
+ }
+
+ public String getPITarget() {
+ return null;
+ }
+
+ public String getPIData() {
+ return null;
+ }
+
+ public boolean isDone() {
+ return state == END_ELEMENT_STATE;
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ this.namespaceContext.setParentNsContext(nsContext);
+ }
+
+ public void init() {
+ // just add the current elements namespace and prefix to the this
+ // elements nscontext
+ addToNsMap(name.getPrefix(), name.getNamespaceURI());
+
+ }
+
+ /**
+ * @param prefix
+ * @param uri
+ */
+ private void addToNsMap(String prefix, String uri) {
+ // todo - need to fix this up to cater for cases where
+ // namespaces are having no prefixes
+ if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
+ // this namespace is not there. Need to declare it
+ namespaceContext.pushNamespace(prefix, uri);
+ nsDeclared = true;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java
new file mode 100644
index 0000000000..04d7d65a0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.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 org.apache.tuscany.sca.databinding.xml;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+/**
+ * A named property
+ *
+ * @version $Rev$ $Date$
+ */
+public class NamedProperty implements Map.Entry<QName, Object> {
+ private QName key;
+
+ private Object value;
+
+ public NamedProperty(QName key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public NamedProperty(String key, Object value) {
+ this.key = new QName(key);
+ this.value = value;
+ }
+
+ public QName getKey() {
+ return key;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public Object setValue(Object value) {
+ Object v = this.value;
+ this.value = value;
+ return v;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
new file mode 100644
index 0000000000..abc4bf3785
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
@@ -0,0 +1,279 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+
+public class NilElementStreamReader implements XMLFragmentStreamReader {
+
+ private static final int END_ELEMENT_STATE = 2;
+
+ private static final int START_ELEMENT_STATE = 1;
+ private int currentState = START_ELEMENT;
+
+ private QName elementQName;
+
+ public NilElementStreamReader(QName elementQName) {
+ this.elementQName = elementQName;
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // NOOP
+ }
+
+ public void close() throws XMLStreamException {
+ // do nothing
+ }
+
+ public int getAttributeCount() {
+ return 1;
+ }
+
+ public String getAttributeLocalName(int i) {
+ return (i == 0) ? NIL_QNAME.getLocalPart() : null;
+ }
+
+ public QName getAttributeName(int i) {
+ return (i == 0) ? NIL_QNAME : null;
+ }
+
+ public String getAttributeNamespace(int i) {
+ return (i == 0) ? NIL_QNAME.getNamespaceURI() : null;
+ }
+
+ public String getAttributePrefix(int i) {
+ return (i == 0) ? NIL_QNAME.getPrefix() : null;
+ }
+
+ public String getAttributeType(int i) {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getAttributeValue(int i) {
+ return (i == 0) ? NIL_VALUE_TRUE : null;
+ }
+
+ public String getAttributeValue(String string, String string1) {
+ if (string == null && NIL_QNAME.getLocalPart().equals(string1)) {
+ return NIL_VALUE_TRUE;
+ }
+ return null;
+ }
+
+ public String getCharacterEncodingScheme() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getElementText() throws XMLStreamException {
+ return null;
+ }
+
+ public String getEncoding() {
+ return null;
+ }
+
+ public int getEventType() {
+ int returnEvent = START_DOCUMENT;
+ switch (currentState) {
+ case START_ELEMENT_STATE:
+ returnEvent = START_ELEMENT;
+ break;
+ case END_ELEMENT_STATE:
+ returnEvent = END_ELEMENT;
+ break;
+ }
+ return returnEvent;
+ }
+
+ public String getLocalName() {
+ return elementQName.getLocalPart();
+ }
+
+ public Location getLocation() {
+ return new Location() {
+ public int getCharacterOffset() {
+ return 0;
+ }
+
+ public int getColumnNumber() {
+ return 0;
+ }
+
+ public int getLineNumber() {
+ return 0;
+ }
+
+ public String getPublicId() {
+ return null;
+ }
+
+ public String getSystemId() {
+ return null;
+ }
+ };
+ }
+
+ public QName getName() {
+ return elementQName;
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getNamespaceCount() {
+ return 0;
+ }
+
+ public String getNamespacePrefix(int i) {
+ return null;
+ }
+
+ public String getNamespaceURI() {
+ return elementQName.getNamespaceURI();
+ }
+
+ public String getNamespaceURI(int i) {
+ return null;
+ }
+
+ public String getNamespaceURI(String string) {
+ if (elementQName.getPrefix() != null && elementQName.getPrefix().equals(string)) {
+ return elementQName.getNamespaceURI();
+ } else {
+ return null;
+ }
+ }
+
+ public String getPIData() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPITarget() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getPrefix() {
+ return elementQName.getPrefix();
+ }
+
+ public Object getProperty(String key) throws IllegalArgumentException {
+ // since optimization is a global property
+ // we've to implement it everywhere
+ return null;
+ }
+
+ public String getText() {
+ return null;
+ }
+
+ public char[] getTextCharacters() {
+ return new char[0];
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ return 0;
+ }
+
+ public int getTextLength() {
+ return 0;
+ }
+
+ public int getTextStart() {
+ return 0;
+ }
+
+ public String getVersion() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean hasName() {
+ return true;
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return currentState != END_ELEMENT_STATE;
+
+ }
+
+ public boolean hasText() {
+ return false;
+ }
+
+ public void init() {
+ // NOOP
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return i == 0;
+ }
+
+ public boolean isCharacters() {
+ return false;
+ }
+
+ public boolean isDone() {
+ return currentState == END_ELEMENT_STATE;
+ }
+
+ public boolean isEndElement() {
+ return currentState == END_ELEMENT_STATE;
+ }
+
+ public boolean isStandalone() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isStartElement() {
+ return currentState == START_ELEMENT_STATE;
+ }
+
+ public boolean isWhiteSpace() {
+ return false;
+ }
+
+ public int next() throws XMLStreamException {
+ int returnEvent = START_DOCUMENT;
+ switch (currentState) {
+ case START_ELEMENT_STATE:
+ currentState = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ break;
+ case END_ELEMENT_STATE:
+ throw new XMLStreamException("parser completed!");
+
+ }
+ return returnEvent;
+ }
+
+ public int nextTag() throws XMLStreamException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ // nothing
+ }
+
+ public boolean standaloneSet() {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
new file mode 100644
index 0000000000..31207ebf68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.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.databinding.xml;
+
+import java.io.OutputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Node to OutputStream
+ */
+public class Node2OutputStream extends BaseTransformer<Node, OutputStream> implements
+ PushTransformer<Node, OutputStream> {
+ private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+
+ public void transform(Node source, OutputStream writer, TransformationContext context) {
+ try {
+ Source domSource = new DOMSource(source);
+ Result result = new StreamResult(writer);
+ TRANSFORMER.transform(domSource, result, context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return OutputStream.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
new file mode 100755
index 0000000000..60be7dbfd3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.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.databinding.xml;
+
+import java.io.StringWriter;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transform DOM Node to XML String
+ */
+public class Node2String extends BaseTransformer<Node, String> implements PullTransformer<Node, String> {
+ private static final Node2Writer TRANSFORMER = new Node2Writer();
+
+ public String transform(Node source, TransformationContext context) {
+ try {
+ StringWriter writer = new StringWriter();
+ TRANSFORMER.transform(source, writer, context);
+ return writer.toString();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
new file mode 100644
index 0000000000..4973319fc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.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.databinding.xml;
+
+import java.io.Writer;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Node to Writer
+ */
+public class Node2Writer extends BaseTransformer<Node, Writer> implements PushTransformer<Node, Writer> {
+ private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+
+ public void transform(Node source, Writer writer, TransformationContext context) {
+ try {
+ Source domSource = new DOMSource(source);
+ Result result = new StreamResult(writer);
+ TRANSFORMER.transform(domSource, result, context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return Writer.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
new file mode 100644
index 0000000000..539e0d7da2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transform DOM Node to XML XMLStreamReader
+ */
+public class Node2XMLStreamReader extends BaseTransformer<Node, XMLStreamReader> implements
+ PullTransformer<Node, XMLStreamReader> {
+
+ public XMLStreamReader transform(Node source, TransformationContext context) {
+ try {
+ DOMXMLStreamReader reader = new DOMXMLStreamReader(source);
+ return new XMLDocumentStreamReader(reader);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Node.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
new file mode 100644
index 0000000000..556f0ef398
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.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.databinding.xml;
+
+import java.io.Reader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Push DOM Reader to Node
+ */
+public class Reader2Node extends BaseTransformer<Reader, Node> implements PullTransformer<Reader, Node> {
+ private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
+
+ public Node transform(Reader source, TransformationContext context) {
+ try {
+ Source streamSource = new StreamSource(source);
+ DOMResult result = new DOMResult();
+ TRANSFORMER.transform(streamSource, result, context);
+ return result.getNode();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
new file mode 100644
index 0000000000..da0dad15cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.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.databinding.xml;
+
+import java.io.Reader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Transform XML string to SAX
+ */
+public class Reader2SAX extends BaseTransformer<Reader, ContentHandler> implements
+ PushTransformer<Reader, ContentHandler> {
+ public void transform(Reader source, ContentHandler target, TransformationContext context) {
+ try {
+ new InputSource2SAX().transform(new InputSource(source), target, context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Reader.class;
+ }
+
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
new file mode 100644
index 0000000000..e6fab7caf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright 2001-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.
+ */
+
+package org.apache.tuscany.sca.databinding.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * SAX2DOM adapter
+ */
+public class SAX2DOM implements ContentHandler, LexicalHandler {
+ public static final String EMPTYSTRING = "";
+ public static final String XML_PREFIX = "xml";
+ public static final String XMLNS_PREFIX = "xmlns";
+ public static final String XMLNS_STRING = "xmlns:";
+ public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
+
+ private Node root;
+
+ private Document document;
+
+ private Node nextSibling;
+
+ private Stack<Node> nodeStk = new Stack<Node>();
+
+ private List<String> namespaceDecls;
+
+ private Node lastSibling;
+
+ public SAX2DOM() throws ParserConfigurationException {
+ this.document = DOMHelper.newDocument();
+ this.root = document;
+ }
+
+ public SAX2DOM(Node root, Node nextSibling) throws ParserConfigurationException {
+ this.root = root;
+ if (root instanceof Document) {
+ this.document = (Document)root;
+ } else if (root != null) {
+ this.document = root.getOwnerDocument();
+ } else {
+ this.document = DOMHelper.newDocument();
+ this.root = document;
+ }
+
+ this.nextSibling = nextSibling;
+ }
+
+ public SAX2DOM(Node root) throws ParserConfigurationException {
+ this(root, null);
+ }
+
+ public Node getDOM() {
+ return root;
+ }
+
+ public void characters(char[] ch, int start, int length) {
+ final Node last = (Node)nodeStk.peek();
+
+ // No text nodes can be children of root (DOM006 exception)
+ if (last != document) {
+ final String text = new String(ch, start, length);
+ if (lastSibling != null && lastSibling.getNodeType() == Node.TEXT_NODE) {
+ ((Text)lastSibling).appendData(text);
+ } else if (last == root && nextSibling != null) {
+ lastSibling = last.insertBefore(document.createTextNode(text), nextSibling);
+ } else {
+ lastSibling = last.appendChild(document.createTextNode(text));
+ }
+
+ }
+ }
+
+ public void startDocument() {
+ nodeStk.push(root);
+ }
+
+ public void endDocument() {
+ nodeStk.pop();
+ }
+
+ public void startElement(String namespace, String localName, String qName, Attributes attrs) {
+ final Element tmp = (Element)document.createElementNS(namespace, qName);
+
+ // Add namespace declarations first
+ if (namespaceDecls != null) {
+ final int nDecls = namespaceDecls.size();
+ for (int i = 0; i < nDecls; i++) {
+ final String prefix = (String)namespaceDecls.get(i++);
+
+ if (prefix == null || prefix.equals(EMPTYSTRING)) {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String)namespaceDecls.get(i));
+ } else {
+ tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, (String)namespaceDecls.get(i));
+ }
+ }
+ namespaceDecls.clear();
+ }
+
+ // Add attributes to element
+ final int nattrs = attrs.getLength();
+ for (int i = 0; i < nattrs; i++) {
+ if (attrs.getLocalName(i) == null) {
+ tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
+ } else {
+ tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i));
+ }
+ }
+
+ // Append this new node onto current stack node
+ Node last = (Node)nodeStk.peek();
+
+ // If the SAX2DOM is created with a non-null next sibling node,
+ // insert the result nodes before the next sibling under the root.
+ if (last == root && nextSibling != null) {
+ last.insertBefore(tmp, nextSibling);
+ } else {
+ last.appendChild(tmp);
+ }
+
+ // Push this node onto stack
+ nodeStk.push(tmp);
+ lastSibling = null;
+ }
+
+ public void endElement(String namespace, String localName, String qName) {
+ nodeStk.pop();
+ lastSibling = null;
+ }
+
+ public void startPrefixMapping(String prefix, String uri) {
+ if (namespaceDecls == null) {
+ namespaceDecls = new ArrayList<String>(2);
+ }
+ namespaceDecls.add(prefix);
+ namespaceDecls.add(uri);
+ }
+
+ public void endPrefixMapping(String prefix) {
+ // do nothing
+ }
+
+ /**
+ * This class is only used internally so this method should never be called.
+ */
+ public void ignorableWhitespace(char[] ch, int start, int length) {
+ }
+
+ /**
+ * adds processing instruction node to DOM.
+ */
+ public void processingInstruction(String target, String data) {
+ final Node last = (Node)nodeStk.peek();
+ ProcessingInstruction pi = document.createProcessingInstruction(target, data);
+ if (pi != null) {
+ if (last == root && nextSibling != null) {
+ last.insertBefore(pi, nextSibling);
+ } else {
+ last.appendChild(pi);
+ }
+
+ lastSibling = pi;
+ }
+ }
+
+ /**
+ * This class is only used internally so this method should never be called.
+ */
+ public void setDocumentLocator(Locator locator) {
+ }
+
+ /**
+ * This class is only used internally so this method should never be called.
+ */
+ public void skippedEntity(String name) {
+ }
+
+ /**
+ * Lexical Handler method to create comment node in DOM tree.
+ */
+ public void comment(char[] ch, int start, int length) {
+ final Node last = (Node)nodeStk.peek();
+ Comment comment = document.createComment(new String(ch, start, length));
+ if (comment != null) {
+ if (last == root && nextSibling != null) {
+ last.insertBefore(comment, nextSibling);
+ } else {
+ last.appendChild(comment);
+ }
+
+ lastSibling = comment;
+ }
+ }
+
+ // Lexical Handler methods- not implemented
+ public void startCDATA() {
+ }
+
+ public void endCDATA() {
+ }
+
+ public void startEntity(java.lang.String name) {
+ }
+
+ public void endDTD() {
+ }
+
+ public void endEntity(String name) {
+ }
+
+ public void startDTD(String name, String publicId, String systemId) throws SAXException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
new file mode 100644
index 0000000000..0f454b8e81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.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.databinding.xml;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+public class SAX2DOMPipe extends BaseTransformer<ContentHandler, Node> implements
+ DataPipe<ContentHandler, Node> {
+ private SAX2DOM pipe;
+
+ /**
+ *
+ */
+ public SAX2DOMPipe() {
+ super();
+ try {
+ this.pipe = new SAX2DOM();
+ } catch (ParserConfigurationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Node getResult() {
+ return pipe.getDOM();
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public ContentHandler getSink() {
+ return pipe;
+ }
+
+ public Class getSourceType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 30;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
new file mode 100755
index 0000000000..7b562096a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.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.databinding.xml;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+/**
+ * Transform TrAX Source to Result
+ */
+public class Source2ResultTransformer extends BaseTransformer<Source, Result> implements
+ PushTransformer<Source, Result> {
+ private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
+
+ public void transform(Source source, Result result, TransformationContext context) {
+ try {
+ javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
+ transformer.transform(source, result);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return Source.class;
+ }
+
+ public Class getTargetType() {
+ return Result.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
new file mode 100644
index 0000000000..6257681091
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+/**
+ * Adapter that converts from StAX to SAX event streams. Currently the following
+ * SAX events are not generated:
+ * <ul>
+ * <li>ignorableWhitespace</li>
+ * <li>skippedEntity</li>
+ * <ul>
+ * Also the following StAX events are not mapped:
+ * <ul>
+ * <li>CDATA</li>
+ * <li>COMMENT</li>
+ * <li>DTD</li>
+ * <li>ENTITY_DECLARATION</li>
+ * <li>ENTITY_REFERENCE</li>
+ * <li>NOTATION_DECLARATION</li>
+ * <li>SPACE</li>
+ * </ul>
+ * StAX ATTRIBUTE events are ignored but the equivalent attributes (derived from
+ * the START_ELEMENT event) are supplied in the SAX startElement event's
+ * Attributes parameter. If the adaptor is configured to pass namespace prefixes
+ * then namespace information will also be included in the Attributes; StAX
+ * NAMESPACE events are ignored. <p/> Another issue is namespace processing. If
+ * the reader is positioned at a sub-node, we cannot capture all the in-scope
+ * namespace bindings. Therefore we cannot re-create a proper SAX event stream
+ * from a StAX parser. <p/> For example <p/> &lt;a:root xmlns:a="foo"
+ * xmlns:b="bar"&gt;&lt;b:sub&gt;a:foo&lt;/b:sub&gt;&lt;/a:root&gt; <p/> And if
+ * you are handed a parser at &lt;b:sub&gt;, then your SAX events should look
+ * like: <p/> &lt;b:sub xmlns:a="foo" xmlns:b="bar"&gt;a:foo&lt;/b:sub&gt; <p/>
+ * not: <p/> &lt;b:sub&gt;a:foo&lt;/b:sub&gt; <p/> <p/> Proposal: we change the
+ * receiver of SAX events (SDOXMLResourceImpl) so that it uses NamespaceContext
+ * to resolve prefix (as opposed to record start/endPrefixMappings and use it
+ * for resolution.)
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAX2SAXAdapter {
+ private final boolean namespacePrefixes;
+
+ /**
+ * Construct a new StAX to SAX adapter that will convert a StAX event stream
+ * into a SAX event stream.
+ *
+ * @param namespacePrefixes whether xmlns attributes should be included in
+ * startElement events;
+ */
+ public StAX2SAXAdapter(boolean namespacePrefixes) {
+ this.namespacePrefixes = namespacePrefixes;
+ }
+
+ /**
+ * Pull events from the StAX stream and dispatch to the SAX ContentHandler.
+ * The StAX stream would typically be located on a START_DOCUMENT or
+ * START_ELEMENT event and when this method returns it will be located on
+ * the associated END_DOCUMENT or END_ELEMENT event. Behaviour with other
+ * start events is undefined.
+ *
+ * @param reader StAX event source to read
+ * @param handler SAX ContentHandler for processing events
+ * @throws XMLStreamException if there was a problem reading the stream
+ * @throws SAXException passed through from the ContentHandler
+ */
+ public void parse(XMLStreamReader reader, ContentHandler handler) throws XMLStreamException, SAXException {
+ handler.setDocumentLocator(new LocatorAdaptor(reader.getLocation()));
+
+ // remembers the nest level of elements to know when we are done
+ int level = 0;
+ int event = reader.getEventType();
+ while (true) {
+ switch (event) {
+ case XMLStreamConstants.START_DOCUMENT:
+ level++;
+ handler.startDocument();
+ break;
+ case XMLStreamConstants.START_ELEMENT:
+ level++;
+ handleStartElement(reader, handler);
+ break;
+ case XMLStreamConstants.PROCESSING_INSTRUCTION:
+ handler.processingInstruction(reader.getPITarget(), reader.getPIData());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ handler.characters(reader.getTextCharacters(), reader.getTextStart(), reader
+ .getTextLength());
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ handleEndElement(reader, handler);
+ level--;
+ if (level == 0) {
+ return;
+ }
+ break;
+ case XMLStreamConstants.END_DOCUMENT:
+ handler.endDocument();
+ return;
+ /*
+ * uncomment to handle all events rather than just mapped
+ * ones // StAX events that are not mapped to SAX case
+ * XMLStreamConstants.COMMENT: case
+ * XMLStreamConstants.SPACE: case
+ * XMLStreamConstants.ENTITY_REFERENCE: case
+ * XMLStreamConstants.DTD: case XMLStreamConstants.CDATA:
+ * case XMLStreamConstants.NOTATION_DECLARATION: case
+ * XMLStreamConstants.ENTITY_DECLARATION: break; // StAX
+ * events handled in START_ELEMENT case
+ * XMLStreamConstants.ATTRIBUTE: case
+ * XMLStreamConstants.NAMESPACE: break; default: throw new
+ * AssertionError("Unknown StAX event: " + event);
+ */
+ }
+ event = reader.next();
+ }
+ }
+
+ private void handleStartElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
+ // send startPrefixMapping events immediately before startElement event
+ int nsCount = reader.getNamespaceCount();
+ for (int i = 0; i < nsCount; i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.startPrefixMapping(prefix, reader.getNamespaceURI(i));
+ }
+
+ // fire startElement
+ QName qname = reader.getName();
+ String prefix = qname.getPrefix();
+ String rawname;
+ if (prefix == null || prefix.length() == 0) {
+ rawname = qname.getLocalPart();
+ } else {
+ rawname = prefix + ':' + qname.getLocalPart();
+ }
+ Attributes attrs = getAttributes(reader);
+ handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
+ }
+
+ private static void handleEndElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
+ // fire endElement
+ QName qname = reader.getName();
+ handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString());
+
+ // send endPrefixMapping events immediately after endElement event
+ // we send them in the opposite order to that returned but this is not
+ // actually required by SAX
+ int nsCount = reader.getNamespaceCount();
+ for (int i = nsCount - 1; i >= 0; i--) {
+ String prefix = reader.getNamespacePrefix(i);
+ if (prefix == null) { // true for default namespace
+ prefix = "";
+ }
+ handler.endPrefixMapping(prefix);
+ }
+ }
+
+ /**
+ * Get the attributes associated with the current START_ELEMENT event.
+ *
+ * @return the StAX attributes converted to org.xml.sax.Attributes
+ */
+ private Attributes getAttributes(XMLStreamReader reader) {
+ assert reader.getEventType() == XMLStreamConstants.START_ELEMENT;
+
+ AttributesImpl attrs = new AttributesImpl();
+
+ // add namespace declarations if required
+ if (namespacePrefixes) {
+ for (int i = 0; i < reader.getNamespaceCount(); i++) {
+ String prefix = reader.getNamespacePrefix(i);
+ String uri = reader.getNamespaceURI(i);
+ attrs.addAttribute(null, prefix, "xmlns:" + prefix, "CDATA", uri);
+ }
+ }
+
+ // Regular attributes
+ for (int i = 0; i < reader.getAttributeCount(); i++) {
+ String uri = reader.getAttributeNamespace(i);
+ if (uri == null) {
+ uri = "";
+ }
+ String localName = reader.getAttributeLocalName(i);
+ String prefix = reader.getAttributePrefix(i);
+ String qname;
+ if (prefix == null || prefix.length() == 0) {
+ qname = localName;
+ } else {
+ qname = prefix + ':' + localName;
+ }
+ String type = reader.getAttributeType(i);
+ String value = reader.getAttributeValue(i);
+
+ attrs.addAttribute(uri, localName, qname, type, value);
+ }
+
+ return attrs;
+ }
+
+ /**
+ * Adaptor for mapping Locator information.
+ */
+ private static final class LocatorAdaptor implements Locator {
+ private final Location location;
+
+ private LocatorAdaptor(Location location) {
+ this.location = location;
+ }
+
+ public int getColumnNumber() {
+ return location == null ? 0 : location.getColumnNumber();
+ }
+
+ public int getLineNumber() {
+ return location == null ? 0 : location.getLineNumber();
+ }
+
+ public String getPublicId() {
+ return location == null ? "" : location.getPublicId();
+ }
+
+ public String getSystemId() {
+ return location == null ? "" : location.getSystemId();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
new file mode 100644
index 0000000000..e5fb47dab3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.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.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * A DataBinding for the StAX
+ *
+ * @version $Rev$ $Date$
+ */
+public class StAXDataBinding extends BaseDataBinding {
+ public static final String NAME = XMLStreamReader.class.getName();
+ public static final String[] ALIASES = new String[] {"stax"};
+
+ public StAXDataBinding() {
+ super(NAME, ALIASES, XMLStreamReader.class);
+ }
+
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (super.introspect(type, annotations)) {
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java
new file mode 100755
index 0000000000..103ecbd7d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.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.sca.databinding.xml;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
+
+
+public final class StAXHelper {
+ private static final XMLInputFactory INPUT_FACTORY = XMLInputFactory.newInstance();
+ private static final XMLOutputFactory OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+ private StAXHelper() {
+ }
+
+ public static XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(inputStream);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(reader);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+ return INPUT_FACTORY.createXMLStreamReader(source);
+ }
+
+ public static XMLStreamReader createXMLStreamReader(String string) throws XMLStreamException {
+ StringReader reader = new StringReader(string);
+ return createXMLStreamReader(reader);
+ }
+
+ public static String save(XMLStreamReader reader) throws XMLStreamException {
+ StringWriter writer = new StringWriter();
+ save(reader, writer);
+ return writer.toString();
+ }
+
+ public static void save(XMLStreamReader reader, OutputStream outputStream) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(outputStream);
+ serializer.serialize(reader, streamWriter);
+ streamWriter.flush();
+ }
+
+ public static void save(XMLStreamReader reader, Writer writer) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(writer);
+ serializer.serialize(reader, streamWriter);
+ streamWriter.flush();
+ }
+
+ public static void save(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
+ XMLStreamSerializer serializer = new XMLStreamSerializer();
+ serializer.serialize(reader, writer);
+ writer.flush();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
new file mode 100755
index 0000000000..ef1cdd809a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.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.databinding.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class StreamDataPipe extends BaseTransformer<OutputStream, InputStream> implements
+ DataPipe<OutputStream, InputStream> {
+
+ private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ public InputStream getResult() {
+ return new ByteArrayInputStream(outputStream.toByteArray());
+ }
+
+ public Class getTargetType() {
+ return InputStream.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+ public OutputStream getSink() {
+ return outputStream;
+ }
+
+ public Class getSourceType() {
+ return OutputStream.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
new file mode 100755
index 0000000000..0e78d7bb8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.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.databinding.xml;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+public class String2Node extends BaseTransformer<String, Node> implements PullTransformer<String, Node> {
+
+ public Node transform(String source, TransformationContext context) {
+ try {
+ DocumentBuilder builder = DOMHelper.newDocumentBuilder();
+ InputSource inputSource = new InputSource(new StringReader(source));
+ return builder.parse(inputSource);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
new file mode 100644
index 0000000000..82ab958c15
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.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.databinding.xml;
+
+import java.io.StringReader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Transform XML string to SAX
+ */
+public class String2SAX extends BaseTransformer<String, ContentHandler> implements
+ PushTransformer<String, ContentHandler> {
+
+ public void transform(String source, ContentHandler target, TransformationContext context) {
+ try {
+ new InputSource2SAX().transform(new InputSource(new StringReader(source)), target, context);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
new file mode 100755
index 0000000000..275462d266
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class String2XMLStreamReader extends BaseTransformer<String, XMLStreamReader> implements
+ PullTransformer<String, XMLStreamReader> {
+
+ public XMLStreamReader transform(String source, TransformationContext context) {
+ try {
+ return StAXHelper.createXMLStreamReader(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return String.class;
+ }
+
+ public Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
new file mode 100644
index 0000000000..dbf5de55cd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+public class WrappingXMLStreamReader implements XMLFragmentStreamReader {
+
+ private XMLStreamReader reader;
+
+ public WrappingXMLStreamReader(XMLStreamReader reader) {
+ this.reader = reader;
+ }
+
+ public boolean isDone() {
+ try {
+ return !hasNext();
+ } catch (XMLStreamException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public Object getProperty(String string) throws IllegalArgumentException {
+ return reader.getProperty(string);
+ }
+
+ public int next() throws XMLStreamException {
+ return reader.next();
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ // nothing to do
+ }
+
+ public String getElementText() throws XMLStreamException {
+ return reader.getElementText();
+ }
+
+ public int nextTag() throws XMLStreamException {
+ return reader.nextTag();
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ return reader.hasNext();
+ }
+
+ public void close() throws XMLStreamException {
+ reader.close();
+ }
+
+ public String getNamespaceURI(String string) {
+ return reader.getNamespaceURI(string);
+ }
+
+ public boolean isStartElement() {
+ return reader.isStartElement();
+ }
+
+ public boolean isEndElement() {
+ return reader.isEndElement();
+ }
+
+ public boolean isCharacters() {
+ return reader.isCharacters();
+ }
+
+ public boolean isWhiteSpace() {
+ return reader.isWhiteSpace();
+ }
+
+ public String getAttributeValue(String string, String string1) {
+ return reader.getAttributeValue(string, string1);
+ }
+
+ public int getAttributeCount() {
+ return reader.getAttributeCount();
+ }
+
+ public QName getAttributeName(int i) {
+ return reader.getAttributeName(i);
+ }
+
+ public String getAttributeNamespace(int i) {
+ return reader.getAttributeNamespace(i);
+ }
+
+ public String getAttributeLocalName(int i) {
+ return reader.getAttributeLocalName(i);
+ }
+
+ public String getAttributePrefix(int i) {
+ return reader.getAttributeLocalName(i);
+ }
+
+ public String getAttributeType(int i) {
+ return reader.getAttributeType(i);
+ }
+
+ public String getAttributeValue(int i) {
+ return reader.getAttributeValue(i);
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return reader.isAttributeSpecified(i);
+ }
+
+ public int getNamespaceCount() {
+ return reader.getNamespaceCount();
+ }
+
+ public String getNamespacePrefix(int i) {
+ return reader.getNamespacePrefix(i);
+ }
+
+ public String getNamespaceURI(int i) {
+ return reader.getNamespaceURI(i);
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return reader.getNamespaceContext();
+ }
+
+ public int getEventType() {
+ return reader.getEventType();
+ }
+
+ public String getText() {
+ return reader.getText();
+ }
+
+ public char[] getTextCharacters() {
+ return reader.getTextCharacters();
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ return reader.getTextCharacters(i, chars, i1, i2);
+ }
+
+ public int getTextStart() {
+ return reader.getTextStart();
+ }
+
+ public int getTextLength() {
+ return reader.getTextLength();
+ }
+
+ public String getEncoding() {
+ return reader.getEncoding();
+ }
+
+ public boolean hasText() {
+ return reader.hasText();
+ }
+
+ public Location getLocation() {
+ return reader.getLocation();
+ }
+
+ public QName getName() {
+ return reader.getName();
+ }
+
+ public String getLocalName() {
+ return reader.getLocalName();
+ }
+
+ public boolean hasName() {
+ return reader.hasName();
+ }
+
+ public String getNamespaceURI() {
+ return reader.getNamespaceURI();
+ }
+
+ public String getPrefix() {
+ return reader.getPrefix();
+ }
+
+ public String getVersion() {
+ return reader.getVersion();
+ }
+
+ public boolean isStandalone() {
+ return reader.isStandalone();
+ }
+
+ public boolean standaloneSet() {
+ return reader.standaloneSet();
+ }
+
+ public String getCharacterEncodingScheme() {
+ return reader.getCharacterEncodingScheme();
+ }
+
+ public String getPITarget() {
+ return reader.getPITarget();
+ }
+
+ public String getPIData() {
+ return reader.getPIData();
+ }
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // nothing to do here
+ }
+
+ public void init() {
+ // Nothing to do here
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
new file mode 100755
index 0000000000..66369adf28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.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.sca.databinding.xml;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import org.apache.tuscany.sca.databinding.DataPipe;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class Writer2ReaderDataPipe extends BaseTransformer<Writer, Reader> implements DataPipe<Writer, Reader> {
+
+ private StringWriter writer = new StringWriter();
+
+ public Reader getResult() {
+ return new StringReader(writer.toString());
+ }
+
+ public Class getTargetType() {
+ return Reader.class;
+ }
+
+ public int getWeight() {
+ return 50;
+ }
+
+ public Writer getSink() {
+ return writer;
+ }
+
+ public Class getSourceType() {
+ return Writer.class;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
new file mode 100644
index 0000000000..e2bebd0eb0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
@@ -0,0 +1,451 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.util.NoSuchElementException;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * This class is derived from Apache Axis2 class
+ * org.apache.axis2.util.StreamWrapper</a>. It's used wrap a XMLStreamReader to
+ * create a XMLStreamReader representing a document and it will produce
+ * START_DOCUMENT, END_DOCUMENT events.
+ */
+public class XMLDocumentStreamReader implements XMLStreamReader {
+ private static final int STATE_COMPLETE_AT_NEXT = 2; // The wrapper
+ // will produce
+ // END_DOCUMENT
+
+ private static final int STATE_COMPLETED = 3; // Done
+
+ private static final int STATE_INIT = 0; // The wrapper will produce
+ // START_DOCUMENT
+
+ private static final int STATE_SWITCHED = 1; // The real reader will
+ // produce events
+
+ private XMLStreamReader realReader;
+
+ private int state = STATE_INIT;
+
+ public XMLDocumentStreamReader(XMLStreamReader realReader) {
+ if (realReader == null) {
+ throw new UnsupportedOperationException("Reader cannot be null");
+ }
+
+ this.realReader = realReader;
+
+ if (realReader instanceof XMLFragmentStreamReader) {
+ ((XMLFragmentStreamReader)realReader).init();
+ }
+
+ // If the real reader is positioned at START_DOCUMENT, always use
+ // the real reader
+ if (realReader.getEventType() == START_DOCUMENT) {
+ state = STATE_SWITCHED;
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ realReader.close();
+ }
+
+ public int getAttributeCount() {
+ if (isDelegating()) {
+ return realReader.getAttributeCount();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeLocalName(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public QName getAttributeName(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeName(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeNamespace(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributePrefix(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeType(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeType(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeValue(int i) {
+ if (isDelegating()) {
+ return realReader.getAttributeValue(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeValue(String s, String s1) {
+ if (isDelegating()) {
+ return realReader.getAttributeValue(s, s1);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getCharacterEncodingScheme() {
+ return realReader.getCharacterEncodingScheme();
+ }
+
+ public String getElementText() throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.getElementText();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public String getEncoding() {
+ return realReader.getEncoding();
+ }
+
+ public int getEventType() {
+ int event = -1;
+ switch (state) {
+ case STATE_SWITCHED:
+ case STATE_COMPLETE_AT_NEXT:
+ event = realReader.getEventType();
+ break;
+ case STATE_INIT:
+ event = START_DOCUMENT;
+ break;
+ case STATE_COMPLETED:
+ event = END_DOCUMENT;
+ break;
+ }
+ return event;
+ }
+
+ public String getLocalName() {
+ if (isDelegating()) {
+ return realReader.getLocalName();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public Location getLocation() {
+ if (isDelegating()) {
+ return realReader.getLocation();
+ } else {
+ return null;
+ }
+ }
+
+ public QName getName() {
+ if (isDelegating()) {
+ return realReader.getName();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ return realReader.getNamespaceContext();
+ }
+
+ public int getNamespaceCount() {
+ if (isDelegating()) {
+ return realReader.getNamespaceCount();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespacePrefix(int i) {
+ if (isDelegating()) {
+ return realReader.getNamespacePrefix(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI() {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI(int i) {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI(i);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getNamespaceURI(String s) {
+ if (isDelegating()) {
+ return realReader.getNamespaceURI(s);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPIData() {
+ if (isDelegating()) {
+ return realReader.getPIData();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPITarget() {
+ if (isDelegating()) {
+ return realReader.getPITarget();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getPrefix() {
+ if (isDelegating()) {
+ return realReader.getPrefix();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public Object getProperty(String s) throws IllegalArgumentException {
+ if (isDelegating()) {
+ return realReader.getProperty(s);
+ } else {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public String getText() {
+ if (isDelegating()) {
+ return realReader.getText();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (isDelegating()) {
+ return realReader.getTextCharacters();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.getTextCharacters(i, chars, i1, i2);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (isDelegating()) {
+ return realReader.getTextLength();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextStart() {
+ if (isDelegating()) {
+ return realReader.getTextStart();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getVersion() {
+ if (isDelegating()) {
+ return realReader.getVersion();
+ } else {
+ return null;
+ }
+ }
+
+ public boolean hasName() {
+ if (isDelegating()) {
+ return realReader.hasName();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean hasNext() throws XMLStreamException {
+ if (state == STATE_COMPLETE_AT_NEXT) {
+ return true;
+ } else if (state == STATE_COMPLETED) {
+ return false;
+ } else if (state == STATE_SWITCHED) {
+ return realReader.hasNext();
+ } else {
+ return true;
+ }
+ }
+
+ public boolean hasText() {
+ if (isDelegating()) {
+ return realReader.hasText();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ if (isDelegating()) {
+ return realReader.isAttributeSpecified(i);
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isCharacters() {
+ if (isDelegating()) {
+ return realReader.isCharacters();
+ } else {
+ return false;
+ }
+ }
+
+ private boolean isDelegating() {
+ return state == STATE_SWITCHED || state == STATE_COMPLETE_AT_NEXT;
+ }
+
+ public boolean isEndElement() {
+ if (isDelegating()) {
+ return realReader.isEndElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isStandalone() {
+ if (isDelegating()) {
+ return realReader.isStandalone();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isStartElement() {
+ if (isDelegating()) {
+ return realReader.isStartElement();
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isWhiteSpace() {
+ if (isDelegating()) {
+ return realReader.isWhiteSpace();
+ } else {
+ return false;
+ }
+ }
+
+ public int next() throws XMLStreamException {
+ int returnEvent;
+
+ switch (state) {
+ case STATE_SWITCHED:
+ returnEvent = realReader.next();
+ if (returnEvent == END_DOCUMENT) {
+ state = STATE_COMPLETED;
+ } else if (!realReader.hasNext()) {
+ state = STATE_COMPLETE_AT_NEXT;
+ }
+ break;
+ case STATE_INIT:
+ state = STATE_SWITCHED;
+ returnEvent = realReader.getEventType();
+ break;
+ case STATE_COMPLETE_AT_NEXT:
+ state = STATE_COMPLETED;
+ returnEvent = END_DOCUMENT;
+ break;
+ case STATE_COMPLETED:
+ // oops - no way we can go beyond this
+ throw new NoSuchElementException("End of stream has reached.");
+ default:
+ throw new UnsupportedOperationException();
+ }
+
+ return returnEvent;
+ }
+
+ public int nextTag() throws XMLStreamException {
+ if (isDelegating()) {
+ return realReader.nextTag();
+ } else {
+ throw new XMLStreamException();
+ }
+ }
+
+ public void require(int i, String s, String s1) throws XMLStreamException {
+ if (isDelegating()) {
+ realReader.require(i, s, s1);
+ }
+ }
+
+ public boolean standaloneSet() {
+ if (isDelegating()) {
+ return realReader.standaloneSet();
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java
new file mode 100644
index 0000000000..a42d6acc9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.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.sca.databinding.xml;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+public interface XMLFragmentStreamReader extends XMLStreamReader {
+ QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
+ String NIL_VALUE_TRUE = "true";
+
+ /**
+ * this will help to handle Text within the current element. user should
+ * pass the element text to the property list as this ELEMENT_TEXT as the
+ * key. This key deliberately has a space in it so that it is not a valid
+ * XML name
+ */
+ String ELEMENT_TEXT = "Element Text";
+
+ /**
+ * Extra method to query the state of the pullparser
+ */
+ boolean isDone();
+
+ /**
+ * add the parent namespace context to this parser
+ */
+ void setParentNamespaceContext(NamespaceContext nsContext);
+
+ /**
+ * Initiate the parser - this will do whatever the needed tasks to initiate
+ * the parser and must be called before attempting any specific parsing
+ * using this parser
+ */
+ void init();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
new file mode 100644
index 0000000000..6d8687c89e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
@@ -0,0 +1,857 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * This is the new implementation of the XMLFramentStreamReader. The approach
+ * here is simple When the pull parser needs to generate events for a particular
+ * name-value(s) pair it always handes over (delegates) the task to another pull
+ * parser which knows how to deal with it The common types of name value pairs
+ * we'll come across are
+ * <ul>
+ * <li> String name/QName name - String value
+ * <li> String name/QName name - String[] value
+ * <li> QName name/String name - XMLStreamReader value
+ * <li> QName name/String name - XMLStreamable value
+ * <li> QName name/String name - Java bean
+ * <li> QName name/String name - Datahandler
+ *
+ * </ul>
+ * <p/> As for the attributes, these are the possible combinations in the array
+ * <ul>
+ * <li> String name/QName name - String value
+ * </ul>
+ * Note that certain array methods have been deliberately removed to avoid
+ * complications. The generated code will take the trouble to lay the elements
+ * of the array in the correct order <p/> <p/> Hence there will be a parser impl
+ * that knows how to handle these types, and this parent parser will always
+ * delegate these tasks to the child pullparasers in effect this is one huge
+ * state machine that has only a few states and delegates things down to the
+ * child parsers whenever possible <p/>
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLFragmentStreamReaderImpl implements XMLFragmentStreamReader {
+
+ private static final int DELEGATED_STATE = 2;
+ private static final int END_ELEMENT_STATE = 1;
+ // states for this pullparser - it can only have four states
+ private static final int START_ELEMENT_STATE = 0;
+ private static final int TEXT_STATE = 3;
+
+ protected NamedProperty[] attributes;
+
+ // reference to the child reader
+ protected XMLFragmentStreamReader childReader;
+ // current property index
+ // initialized at zero
+ protected int index;
+ protected Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
+ protected QName elementQName;
+
+ // we always create a new namespace context
+ protected DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
+
+ protected NamedProperty[] elements;
+
+ // integer field that keeps the state of this
+ // parser.
+ protected int state = START_ELEMENT_STATE;
+
+ /*
+ * we need to pass in a namespace context since when delegated, we've no
+ * idea of the current namespace context. So it needs to be passed on here!
+ */
+ public XMLFragmentStreamReaderImpl(QName elementQName, NamedProperty[] elements, NamedProperty[] attributes) {
+ // validate the lengths, since both the arrays are supposed
+ // to have
+ this.elements = elements == null ? new NamedProperty[0] : elements;
+ this.elementQName = elementQName;
+ this.attributes = attributes == null ? new NamedProperty[0] : attributes;
+ }
+
+ protected XMLFragmentStreamReaderImpl(QName elementQName) {
+ this.elementQName = elementQName;
+ }
+
+ /**
+ * add the namespace context
+ */
+
+ public void setParentNamespaceContext(NamespaceContext nsContext) {
+ // register the namespace context passed in to this
+ this.namespaceContext.setParentNsContext(nsContext);
+
+ }
+
+ protected NamedProperty[] getElements() {
+ return elements;
+ }
+
+ protected NamedProperty[] getAttributes() {
+ return attributes;
+ }
+
+ protected QName[] getNamespaces() {
+ return new QName[0];
+ }
+
+ /**
+ * @param prefix
+ * @param uri
+ */
+ protected void addToNsMap(String prefix, String uri) {
+ if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
+ namespaceContext.pushNamespace(prefix, uri);
+ declaredNamespaceMap.put(prefix, uri);
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ // do nothing here - we have no resources to free
+ }
+
+ public int getAttributeCount() {
+ return (state == DELEGATED_STATE) ? childReader.getAttributeCount() : (state == START_ELEMENT_STATE
+ ? getAttributes().length : 0);
+ }
+
+ public String getAttributeLocalName(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeLocalName(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getLocalPart();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ * @param i
+ */
+ public QName getAttributeName(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeName(i);
+ } else if (state == START_ELEMENT_STATE) {
+ if ((i >= (getAttributes().length)) || i < 0) { // out of range
+ return null;
+ } else {
+ // get the attribute pointer
+ QName attribPointer = getAttributes()[i].getKey();
+ // case one - attrib name is null
+ // this should be the pointer to the OMAttribute then
+ if (attribPointer == null) {
+ throw new UnsupportedOperationException();
+ } else if (attribPointer instanceof QName) {
+ return (QName)attribPointer;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ throw new IllegalStateException(); // as per the api contract
+ }
+
+ }
+
+ public String getAttributeNamespace(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeNamespace(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getNamespaceURI();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributePrefix(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributePrefix(i);
+ } else if (state == START_ELEMENT_STATE) {
+ QName name = getAttributeName(i);
+ if (name == null) {
+ return null;
+ } else {
+ return name.getPrefix();
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getAttributeType(int i) {
+ return null; // not supported
+ }
+
+ public String getAttributeValue(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getAttributeValue(i);
+ } else if (state == START_ELEMENT_STATE) {
+ if ((i >= (getAttributes().length)) || i < 0) { // out of range
+ return null;
+ } else {
+ // get the attribute pointer
+ QName attribPointer = getAttributes()[i].getKey();
+ Object omAttribObj = getAttributes()[i].getValue();
+ // case one - attrib name is null
+ // this should be the pointer to the OMAttribute then
+ if (attribPointer == null) {
+ throw new UnsupportedOperationException();
+ } else if (attribPointer instanceof QName) {
+ return (String)omAttribObj;
+ } else {
+ return null;
+ }
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getAttributeValue(String nsUri, String localName) {
+
+ int attribCount = getAttributeCount();
+ String returnValue = null;
+ QName attribQualifiedName;
+ for (int i = 0; i < attribCount; i++) {
+ attribQualifiedName = getAttributeName(i);
+ if (nsUri == null) {
+ if (localName.equals(attribQualifiedName.getLocalPart())) {
+ returnValue = getAttributeValue(i);
+ break;
+ }
+ } else {
+ if (localName.equals(attribQualifiedName.getLocalPart()) && nsUri.equals(attribQualifiedName
+ .getNamespaceURI())) {
+ returnValue = getAttributeValue(i);
+ break;
+ }
+ }
+
+ }
+
+ return returnValue;
+ }
+
+ public String getCharacterEncodingScheme() {
+ return null; // todo - should we return something for this ?
+ }
+
+ /**
+ * todo implement the right contract for this
+ *
+ * @throws XMLStreamException
+ */
+ public String getElementText() throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ return childReader.getElementText();
+ } else {
+ return null;
+ }
+
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // / attribute handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ public String getEncoding() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getEncoding();
+ } else {
+ // we've no idea what the encoding is going to be in this case
+ // perhaps we ought to return some constant here, which the user
+ // might
+ // have access to change!
+ return null;
+ }
+ }
+
+ public int getEventType() {
+ if (state == START_ELEMENT_STATE) {
+ return START_ELEMENT;
+ } else if (state == END_ELEMENT_STATE) {
+ return END_ELEMENT;
+ } else if (state == TEXT_STATE) {
+ return CHARACTERS;
+ } else { // this is the delegated state
+ return childReader.getEventType();
+ }
+ }
+
+ public String getLocalName() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getLocalName();
+ } else if (state != TEXT_STATE) {
+ return elementQName.getLocalPart();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ /**
+ */
+ public Location getLocation() {
+ // return a default location
+ return new Location() {
+ public int getCharacterOffset() {
+ return 0;
+ }
+
+ public int getColumnNumber() {
+ return 0;
+ }
+
+ public int getLineNumber() {
+ return 0;
+ }
+
+ public String getPublicId() {
+ return null;
+ }
+
+ public String getSystemId() {
+ return null;
+ }
+ };
+ }
+
+ public QName getName() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getName();
+ } else if (state != TEXT_STATE) {
+ return elementQName;
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public NamespaceContext getNamespaceContext() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceContext();
+ } else {
+ return namespaceContext;
+ }
+
+ }
+
+ public int getNamespaceCount() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceCount();
+ } else {
+ return declaredNamespaceMap.size();
+ }
+ }
+
+ /**
+ * @param i
+ */
+ public String getNamespacePrefix(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespacePrefix(i);
+ } else if (state != TEXT_STATE) {
+ // order the prefixes
+ String[] prefixes = makePrefixArray();
+ if ((i >= prefixes.length) || (i < 0)) {
+ return null;
+ } else {
+ return prefixes[i];
+ }
+
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getNamespaceURI() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceURI();
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else {
+ return elementQName.getNamespaceURI();
+ }
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // //////////// end of attribute handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ // //////////////////////////////////////////////////////////////////////////
+ // //////////// namespace handling
+ // //////////////////////////////////////////////////////////////////////////
+
+ public String getNamespaceURI(int i) {
+ if (state == DELEGATED_STATE) {
+ return childReader.getNamespaceURI(i);
+ } else if (state != TEXT_STATE) {
+ String namespacePrefix = getNamespacePrefix(i);
+ return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix);
+ } else {
+ throw new IllegalStateException();
+ }
+
+ }
+
+ public String getNamespaceURI(String prefix) {
+ return namespaceContext.getNamespaceURI(prefix);
+ }
+
+ public String getPIData() {
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPITarget() {
+ throw new UnsupportedOperationException("Yet to be implemented !!");
+ }
+
+ public String getPrefix() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getPrefix();
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else {
+ String prefix = elementQName.getPrefix();
+ return "".equals(prefix) ? null : prefix;
+ }
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // /////// end of namespace handling
+ // /////////////////////////////////////////////////////////////////////////
+
+ /**
+ * @param key
+ * @throws IllegalArgumentException
+ */
+ public Object getProperty(String key) throws IllegalArgumentException {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return null;
+ } else if (state == TEXT_STATE) {
+ return null;
+ } else if (state == DELEGATED_STATE) {
+ return childReader.getProperty(key);
+ } else {
+ return null;
+ }
+
+ }
+
+ public String getText() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getText();
+ } else if (state == TEXT_STATE) {
+ return (String)getElements()[index - 1].getValue();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public char[] getTextCharacters() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextCharacters();
+ } else if (state == TEXT_STATE) {
+ return getElements()[index - 1].getValue() == null ? new char[0] : ((String)getElements()[index - 1]
+ .getValue()).toCharArray();
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ private int copy(int sourceStart, char[] target, int targetStart, int length) {
+ char[] source = getTextCharacters();
+ if (sourceStart > source.length) {
+ throw new IndexOutOfBoundsException("source start > source length");
+ }
+ int sourceLen = source.length - sourceStart;
+ if (length > sourceLen) {
+ length = sourceLen;
+ }
+ System.arraycopy(source, sourceStart, target, targetStart, length);
+ return sourceLen;
+ }
+
+ public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextCharacters(i, chars, i1, i2);
+ } else if (state == TEXT_STATE) {
+ return copy(i, chars, i1, i2);
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextLength() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextLength();
+ } else if (state == TEXT_STATE) {
+ return getTextCharacters().length;
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public int getTextStart() {
+ if (state == DELEGATED_STATE) {
+ return childReader.getTextStart();
+ } else if (state == TEXT_STATE) {
+ return 0; // assume text always starts at 0
+ } else {
+ throw new IllegalStateException();
+ }
+ }
+
+ public String getVersion() {
+ return null;
+ }
+
+ public boolean hasName() {
+ // since this parser always has a name, the hasname
+ // has to return true if we are still navigating this element
+ // if not we should ask the child reader for it.
+ if (state == DELEGATED_STATE) {
+ return childReader.hasName();
+ } else {
+ return state != TEXT_STATE;
+ }
+ }
+
+ /**
+ * @throws XMLStreamException
+ */
+ public boolean hasNext() throws XMLStreamException {
+ if (state == DELEGATED_STATE) {
+ if (childReader.isDone()) {
+ // the child reader is done. We shouldn't be getting the
+ // hasnext result from the child pullparser then
+ return true;
+ } else {
+ return childReader.hasNext();
+ }
+ } else {
+ return state == START_ELEMENT_STATE || state == TEXT_STATE;
+
+ }
+ }
+
+ /**
+ * check the validity of this implementation
+ */
+ public boolean hasText() {
+ if (state == DELEGATED_STATE) {
+ return childReader.hasText();
+ } else {
+ return state == TEXT_STATE;
+ }
+
+ }
+
+ /**
+ * we need to split out the calling to the populate namespaces seperately
+ * since this needs to be done *after* setting the parent namespace context.
+ * We cannot assume it will happen at construction!
+ */
+ public void init() {
+ // here we have an extra issue to attend to. we need to look at the
+ // prefixes and uris (the combination) and populate a hashmap of
+ // namespaces. The hashmap of namespaces will be used to serve the
+ // namespace context
+
+ populateNamespaceContext();
+ }
+
+ public boolean isAttributeSpecified(int i) {
+ return false; // not supported
+ }
+
+ public boolean isCharacters() {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isCharacters();
+ }
+
+ /**
+ * are we done ?
+ */
+ public boolean isDone() {
+ return state == END_ELEMENT_STATE;
+ }
+
+ public boolean isEndElement() {
+ if (state == START_ELEMENT_STATE) {
+ return false;
+ } else if (state == END_ELEMENT_STATE) {
+ return true;
+ }
+ return childReader.isEndElement();
+ }
+
+ public boolean isStandalone() {
+ return true;
+ }
+
+ public boolean isStartElement() {
+ if (state == START_ELEMENT_STATE) {
+ return true;
+ } else if (state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isStartElement();
+ }
+
+ public boolean isWhiteSpace() {
+ if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
+ return false;
+ }
+ return childReader.isWhiteSpace();
+ }
+
+ /**
+ * Get the prefix list from the hastable and take that into an array
+ */
+ private String[] makePrefixArray() {
+ String[] prefixes = (String[])declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
+ Arrays.sort(prefixes);
+ return prefixes;
+ }
+
+ /**
+ * By far this should be the most important method in this class this method
+ * changes the state of the parser
+ */
+ public int next() throws XMLStreamException {
+ int returnEvent = -1; // invalid state is the default state
+ switch (state) {
+ case START_ELEMENT_STATE:
+ // current element is start element. We should be looking at the
+ // property list and making a pullparser for the property value
+ if (getElements() == null || getElements().length == 0) {
+ // no properties - move to the end element state
+ // straightaway
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ // there are properties. now we should delegate this task to
+ // a
+ // child reader depending on the property type
+ returnEvent = processProperties();
+
+ }
+ break;
+ case END_ELEMENT_STATE:
+ // we've reached the end element already. If the user tries to
+ // push
+ // further ahead then it is an exception
+ throw new XMLStreamException("Trying to go beyond the end of the pullparser");
+
+ case DELEGATED_STATE:
+ if (childReader.isDone()) {
+ // we've reached the end!
+ if (index > (getElements().length - 1)) {
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ returnEvent = processProperties();
+ }
+ } else {
+ returnEvent = childReader.next();
+ }
+ break;
+
+ case TEXT_STATE:
+ // if there are any more event we should be delegating to
+ // processProperties. if not we just return an end element
+ if (index > (getElements().length - 1)) {
+ state = END_ELEMENT_STATE;
+ returnEvent = END_ELEMENT;
+ } else {
+ returnEvent = processProperties();
+ }
+ break;
+ }
+ return returnEvent;
+ }
+
+ // /////////////////////////////////////////////////////////////////////////
+ // / Other utility methods
+ // ////////////////////////////////////////////////////////////////////////
+
+ /**
+ * todo implement this
+ *
+ * @throws XMLStreamException
+ */
+ public int nextTag() throws XMLStreamException {
+ return 0;
+ }
+
+ /**
+ * Populates a namespace context
+ */
+ private void populateNamespaceContext() {
+
+ // first add the current element namespace to the namespace context
+ // declare it if not found
+ addToNsMap(elementQName.getPrefix(), elementQName.getNamespaceURI());
+
+ for (QName n : getNamespaces()) {
+ addToNsMap(n.getPrefix(), n.getNamespaceURI());
+ }
+
+ // traverse through the attributes and populate the namespace context
+ // the attrib list can be of many combinations
+ // the valid combinations are
+ // String - String
+ // QName - QName
+ // null - OMAttribute
+
+ for (int i = 0; i < getAttributes().length; i++) { // jump in two
+ QName attrQName = getAttributes()[i].getKey();
+ if (!"".equals(attrQName.getNamespaceURI())) {
+ addToNsMap(attrQName.getPrefix(), attrQName.getNamespaceURI());
+ }
+ }
+ }
+
+ /**
+ * A convenient method to reuse the properties
+ *
+ * @return event to be thrown
+ * @throws XMLStreamException
+ */
+ private int processProperties() throws XMLStreamException {
+ // move to the next property depending on the current property
+ // index
+ QName propertyQName = getElements()[index].getKey();
+ boolean textFound = false;
+ if (propertyQName == null) {
+ throw new XMLStreamException("property key cannot be null!");
+ } else if (ELEMENT_TEXT.equals(propertyQName.getLocalPart())) {
+ // propPointer being a String has a special case
+ // that is it can be a the special constant ELEMENT_TEXT that
+ // says this text event
+ textFound = true;
+ }
+
+ // ok! we got the key. Now look at the value
+ Object propertyValue = getElements()[index].getValue();
+ // cater for the special case now
+ if (textFound) {
+ // no delegation here - make the parser null and immediately
+ // return with the event characters
+ childReader = null;
+ state = TEXT_STATE;
+ ++index;
+ return CHARACTERS;
+ } else if (propertyValue == null) {
+ // if the value is null we delegate the work to a nullable
+ // parser
+ childReader = new NilElementStreamReader(propertyQName);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else if (propertyValue instanceof String) {
+ // strings are handled by the NameValuePairStreamReader
+ childReader = new NameValuePairStreamReader(propertyQName, (String)propertyValue);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else if (propertyValue instanceof String[]) {
+ // string[] are handled by the NameValueArrayStreamReader
+ // if the array is empty - skip it
+ if (((String[])propertyValue).length == 0) {
+ // advance the index
+ ++index;
+ return processProperties();
+ } else {
+ childReader = new NameValueArrayStreamReader(propertyQName, (String[])propertyValue);
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ }
+
+ } else if (propertyValue instanceof XMLStreamable) {
+ // ADBbean has it's own method to get a reader
+ XMLStreamReader reader = ((XMLStreamable)propertyValue).getXMLStreamReader(propertyQName);
+ // we know for sure that this is an ADB XMLStreamreader.
+ // However we need to make sure that it is compatible
+ if (reader instanceof XMLFragmentStreamReader) {
+ childReader = (XMLFragmentStreamReader)reader;
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else {
+ // wrap it to make compatible
+ childReader = new WrappingXMLStreamReader(reader);
+ }
+ } else if (propertyValue instanceof XMLStreamReader) {
+ XMLStreamReader reader = (XMLStreamReader)propertyValue;
+ if (reader instanceof XMLFragmentStreamReader) {
+ childReader = (XMLFragmentStreamReader)reader;
+ childReader.setParentNamespaceContext(this.namespaceContext);
+ childReader.init();
+ } else {
+ // wrap it to make compatible
+ childReader = new WrappingXMLStreamReader(reader);
+ }
+
+ } else {
+ // all special possiblilities has been tried! Let's treat
+ // the thing as a bean and try generating events from it
+ childReader = new WrappingXMLStreamReader(BeanUtil.getXMLStreamReader(propertyValue, propertyQName));
+ // we cannot register the namespace context here
+ }
+
+ // set the state here
+ state = DELEGATED_STATE;
+ // we are done with the delegation
+ // increment the property index
+ ++index;
+ return childReader.getEventType();
+ }
+
+ public void require(int i, String string, String string1) throws XMLStreamException {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean standaloneSet() {
+ return true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
new file mode 100644
index 0000000000..08bfed9545
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.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.databinding.xml;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+import org.apache.tuscany.sca.databinding.impl.GroupDataBinding;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * A Group DataBinding
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLGroupDataBinding extends GroupDataBinding {
+
+ public XMLGroupDataBinding() {
+ super(new Class[] {InputStream.class, OutputStream.class, Reader.class, Writer.class, Source.class,
+ Result.class, InputSource.class, ContentHandler.class, XMLStreamReader.class,
+ XMLStreamWriter.class, XMLEventReader.class, XMLEventWriter.class});
+ }
+
+ @Override
+ protected Object getLogical(Class<?> markerType, Annotation[] annotations) {
+ return XMLType.UNKNOWN;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
new file mode 100644
index 0000000000..86a9a0912b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.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 org.apache.tuscany.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.w3c.dom.Node;
+
+/**
+ * Transform DOM Node to XML XMLStreamReader
+ */
+public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
+ PullTransformer<XMLStreamReader, Node> {
+ private SAX2DOMPipe pipe = new SAX2DOMPipe();
+
+ private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
+
+ public Node transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ stax2sax.transform(source, pipe.getSink(), context);
+ return pipe.getResult();
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public Class getTargetType() {
+ return Node.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
new file mode 100644
index 0000000000..1ffda0f681
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PushTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.xml.sax.ContentHandler;
+
+/**
+ * XMLStreamReader to SAX events
+ */
+public class XMLStreamReader2SAX extends BaseTransformer<XMLStreamReader, ContentHandler> implements
+ PushTransformer<XMLStreamReader, ContentHandler> {
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getSourceType()
+ */
+ public Class getTargetType() {
+ return ContentHandler.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getSourceType()
+ */
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#getWeight()
+ */
+ public int getWeight() {
+ return 20;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object,
+ * java.lang.Object,
+ * org.apache.tuscany.sca.databinding.TransformationContext)
+ */
+ public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext context) {
+ StAX2SAXAdapter adapter = new StAX2SAXAdapter(false);
+ try {
+ adapter.parse(source, sink);
+ } catch (Exception e) {
+ throw new TransformationException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
new file mode 100755
index 0000000000..a4bb97fb24
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.PullTransformer;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformationException;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+
+public class XMLStreamReader2String extends BaseTransformer<XMLStreamReader, String> implements
+ PullTransformer<XMLStreamReader, String> {
+
+ public String transform(XMLStreamReader source, TransformationContext context) {
+ try {
+ return StAXHelper.save(source);
+ } catch (XMLStreamException e) {
+ throw new TransformationException(e);
+ }
+ }
+
+ public Class getSourceType() {
+ return XMLStreamReader.class;
+ }
+
+ public Class getTargetType() {
+ return String.class;
+ }
+
+ public int getWeight() {
+ return 40;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
new file mode 100644
index 0000000000..93939c5cd7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.databinding.xml;
+
+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 {
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java
new file mode 100644
index 0000000000..f32f93d098
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.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.databinding.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * An interface represents data that can be read using StAX streaming
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XMLStreamable {
+ /**
+ * Get the XMLStreamReader for StAX processing
+ *
+ * @param rootElementName the name of the element to be generated
+ * @return Returns a pull parser.
+ */
+ XMLStreamReader getXMLStreamReader(QName rootElementName);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
new file mode 100644
index 0000000000..bbb88b8bb3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.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.databinding.xml;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+
+/**
+ * A DataBinding for the XML string
+ *
+ * @version $Rev$ $Date$
+ */
+public class XMLStringDataBinding extends BaseDataBinding {
+ public static final String NAME = String.class.getName();
+ public static final String[] ALIASES = new String[] {"xml.string"};
+
+ public XMLStringDataBinding() {
+ super(NAME, ALIASES, String.class);
+ }
+
+ @Override
+ public boolean introspect(DataType type, Annotation[] annotations) {
+ if (registry.getDataBinding(type.getDataBinding()) == this) {
+ type.setDataBinding(getName());
+ type.setLogical(XMLType.UNKNOWN);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java
new file mode 100644
index 0000000000..1039b824ac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.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.databinding.extension;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ *
+ */
+public class DOMHelperTestCase extends TestCase {
+ private static final QName FOO_NAME = new QName("http://foo", "foo");
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testDOM() throws Exception {
+ DocumentBuilder builder = DOMHelper.newDocumentBuilder();
+ assertNotNull(builder);
+ Document document = DOMHelper.newDocument();
+ assertNotNull(document);
+ Element element = DOMHelper.createElement(document, FOO_NAME);
+ document.appendChild(element);
+ QName name = DOMHelper.getQName(element);
+ assertEquals(FOO_NAME, name);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java
new file mode 100644
index 0000000000..25f9a07aa2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.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.sca.databinding.extension;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.easymock.EasyMock;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ */
+public class DataBindingExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testExtension() {
+ DataBinding1 binding1 = new DataBinding1(Node.class);
+ assertEquals(Node.class.getName(), binding1.getName());
+ DataType dt1 = new DataTypeImpl<Class>(Element.class, null);
+ assertTrue(binding1.introspect(dt1, null));
+ DataType dt2 = new DataTypeImpl<Class>(String.class, null);
+ assertFalse(binding1.introspect(dt2, null));
+ assertNull(binding1.getWrapperHandler());
+
+ DataBindingExtensionPoint registry = EasyMock.createMock(DataBindingExtensionPoint.class);
+ registry.addDataBinding(binding1);
+ EasyMock.expect(registry.getDataBinding(Node.class.getName())).andReturn(binding1);
+ EasyMock.replay(registry);
+
+ binding1.setDataBindingRegistry(registry);
+ binding1.init();
+ assertNotNull(registry.getDataBinding(Node.class.getName()));
+
+ DataBinding1 binding2 = new DataBinding1("dom", Node.class);
+ assertEquals("dom", binding2.getName());
+ }
+
+ private static class DataBinding1 extends BaseDataBinding {
+
+ /**
+ * @param baseType
+ */
+ public DataBinding1(Class<?> baseType) {
+ super(baseType);
+ }
+
+ /**
+ * @param name
+ * @param baseType
+ */
+ public DataBinding1(String name, Class<?> baseType) {
+ super(name, baseType);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java
new file mode 100644
index 0000000000..9a5fc21e3f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.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.sca.databinding.extension;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.NamespaceContext;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.easymock.EasyMock;
+
+/**
+ *
+ */
+public class SimpleTypeMapperExtensionTestCase extends TestCase {
+
+ private static final Map<String, Object> SAMPLE_VALUES = new HashMap<String, Object>();
+
+ static {
+ SAMPLE_VALUES.put("anyURI", "http://www.w3.com");
+ SAMPLE_VALUES.put("boolean", new String[] {"true", "false", "1", "0"});
+ SAMPLE_VALUES.put("byte", new String[] {"-128", "127"});
+ SAMPLE_VALUES.put("date", new String[] {"2004-03-15", "2002-09-24-06:00"});
+ SAMPLE_VALUES.put("dateTime", "2003-12-25T08:30:00");
+ SAMPLE_VALUES.put("decimal", "3.1415292");
+ SAMPLE_VALUES.put("double", new String[] {"3.1415292", "INF", "NaN"});
+ SAMPLE_VALUES.put("duration", new String[] {"P8M3DT7H33M2S", "P5Y2M10DT15H"});
+ SAMPLE_VALUES.put("float", new String[] {"3.1415292", "INF", "NaN"});
+ SAMPLE_VALUES.put("gDay", "---11");
+ SAMPLE_VALUES.put("gMonth", "--02--");
+ SAMPLE_VALUES.put("gMonthDay", "--02-14");
+ SAMPLE_VALUES.put("gYear", "1999");
+ SAMPLE_VALUES.put("gYearMonth", "1972-08");
+ SAMPLE_VALUES.put("ID", "id-102");
+ SAMPLE_VALUES.put("IDREF", "id-102");
+ SAMPLE_VALUES.put("IDREFS", "id-102 id-103 id-100");
+ SAMPLE_VALUES.put("int", "77");
+ SAMPLE_VALUES.put("integer", "77");
+ SAMPLE_VALUES.put("long", "214");
+ SAMPLE_VALUES.put("negativeInteger", "-123");
+ SAMPLE_VALUES.put("nonNegativeInteger", "2");
+ SAMPLE_VALUES.put("nonPositiveInteger", "0");
+ SAMPLE_VALUES.put("positiveInteger", "500");
+ SAMPLE_VALUES.put("short", "476");
+ SAMPLE_VALUES.put("string", "Joeseph");
+ SAMPLE_VALUES.put("time", "13:02:00");
+ SAMPLE_VALUES.put("base64Binary", "TWFu");
+ SAMPLE_VALUES.put("hexBinary", "2CDB5F");
+ SAMPLE_VALUES.put("QName", "f:foo");
+ SAMPLE_VALUES.put("NOTATION", "f:bar");
+ }
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testMap() throws Exception {
+ SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
+ TransformationContext context = EasyMock.createMock(TransformationContext.class);
+ Map<String, Object> metaData = new HashMap<String, Object>();
+ EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
+ EasyMock.replay(context);
+
+ NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
+ EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo")
+ .anyTimes();
+ EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
+ EasyMock.replay(namespaceContext);
+ context.getMetadata().put(NamespaceContext.class.getName(), namespaceContext);
+ for (TypeInfo simpleType : SimpleTypeMapperImpl.XSD_SIMPLE_TYPES.values()) {
+ String name = simpleType.getQName().getLocalPart();
+ Object value = SAMPLE_VALUES.get(name);
+ if (value instanceof String[]) {
+ for (String s : (String[])value) {
+ Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
+ String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
+ assertNotNull(str);
+ // assertTrue("[" + name + "] " + s + " " + str,
+ // str.contains((String) s));
+ }
+ } else if (value instanceof String) {
+ Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
+ String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
+ assertNotNull(str);
+ // assertTrue("[" + name + "] " + value + " " + str,
+ // str.contains((String) value));
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java
new file mode 100644
index 0000000000..e5c5e6dd64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.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.databinding.extension;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
+import org.easymock.EasyMock;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for TransformerExtension
+ */
+public class TransformerExtensionTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testExtension() {
+ MyTransformer transformer = new MyTransformer();
+ assertEquals(Node.class.getName(), transformer.getSourceDataBinding());
+ assertEquals(XMLStreamReader.class.getName(), transformer.getTargetDataBinding());
+ assertEquals(50, transformer.getWeight());
+ TransformerExtensionPoint registry = EasyMock.createMock(TransformerExtensionPoint.class);
+ registry.addTransformer(EasyMock.isA(Transformer.class));
+ EasyMock
+ .expect(registry.getTransformer(transformer.getSourceDataBinding(), transformer.getTargetDataBinding()))
+ .andReturn(transformer);
+ EasyMock.replay(registry);
+ transformer.setTransformerRegistry(registry);
+ transformer.init();
+ assertSame(transformer, registry.getTransformer(transformer.getSourceDataBinding(), transformer
+ .getTargetDataBinding()));
+ }
+
+ private static class MyTransformer extends BaseTransformer<Node, XMLStreamReader> {
+
+ @Override
+ protected Class getSourceType() {
+ return Node.class;
+ }
+
+ @Override
+ protected Class getTargetType() {
+ return XMLStreamReader.class;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java
new file mode 100644
index 0000000000..9bcc535e99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.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.databinding.extension;
+
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter;
+
+/**
+ *
+ */
+public class XSDDataTypeConverterTestCase extends TestCase {
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testConvert() throws Exception {
+ XSDDataTypeConverter c = new XSDDataTypeConverter();
+ assertEquals("123", c.parseAnySimpleType(c.printAnySimpleType("123")));
+ assertEquals(true, c.parseBoolean(c.printBoolean(true)));
+ assertEquals(false, c.parseBoolean(c.printBoolean(false)));
+ assertEquals(123.0, c.parseDouble(c.printDouble(123.0)));
+ assertEquals(123.0f, c.parseFloat(c.printFloat(123.0f)));
+ assertEquals(64, c.parseByte(c.printByte((byte)64)));
+ assertEquals(123, c.parseInt(c.printInt(123)));
+ assertEquals(new BigInteger("123456"), c.parseInteger(c.printInteger(new BigInteger("123456"))));
+ assertEquals(123456L, c.parseLong(c.printLong(123456L)));
+ assertEquals((short)123, c.parseShort(c.printShort((short)123)));
+
+ Calendar calendar = new GregorianCalendar();
+ String s = c.printDate(calendar);
+ calendar = (GregorianCalendar)c.parseDate(s);
+ assertEquals(s, c.printDate(calendar));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java
new file mode 100644
index 0000000000..ae237b249c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.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.databinding.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.lang.annotation.Annotation;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.easymock.EasyMock;
+import org.xml.sax.ContentHandler;
+
+/**
+ *
+ */
+public class DataBindingRegistryImplTestCase extends TestCase {
+ private DataBindingExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultDataBindingExtensionPoint();
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testRegistry() {
+ DataBinding db1 = createMock(DataBinding.class);
+ expect(db1.getAliases()).andReturn(new String[] {"db1"}).anyTimes();
+ expect(db1.getName()).andReturn(ContentHandler.class.getName()).anyTimes();
+ DataType<Class> dataType1 = new DataTypeImpl<Class>(ContentHandler.class, ContentHandler.class);
+ expect(db1.introspect(dataType1, null)).andReturn(true);
+ expect(db1.introspect(EasyMock.not(EasyMock.same(dataType1)), (Annotation[])EasyMock.isNull()))
+ .andReturn(false).anyTimes();
+ replay(db1);
+
+ registry.addDataBinding(db1);
+
+ DataBinding db2 = createMock(DataBinding.class);
+ expect(db2.getAliases()).andReturn(new String[] {"db2"}).anyTimes();
+ expect(db2.getName()).andReturn(XMLStreamReader.class.getName()).anyTimes();
+ DataType<Class> dataType2 = new DataTypeImpl<Class>(XMLStreamReader.class, XMLStreamReader.class);
+ expect(db2.introspect(dataType2, null)).andReturn(true);
+ expect(db2.introspect(EasyMock.not(EasyMock.same(dataType2)), (Annotation[])EasyMock.isNull()))
+ .andReturn(false).anyTimes();
+ replay(db2);
+
+ registry.addDataBinding(db2);
+
+ // Lookup by name
+ String name = db1.getName();
+ DataBinding db3 = registry.getDataBinding(name);
+ assertSame(db1, db3);
+
+ // Look up by alias
+ DataBinding db5 = registry.getDataBinding("db1");
+ assertSame(db1, db5);
+
+ DataType dt = new DataTypeImpl<Class>(ContentHandler.class, null);
+ registry.introspectType(dt, null);
+ assertEquals(dataType1.getLogical(), ContentHandler.class);
+ assertTrue(dt.getDataBinding().equalsIgnoreCase("java.lang.Object"));
+
+ registry.removeDataBinding(name);
+ DataBinding db4 = registry.getDataBinding(name);
+ assertNull(db4);
+
+ dt = new DataTypeImpl<Class>(null, String.class, null);
+ registry.introspectType(dt, null);
+ assertEquals("java.lang.Object", dt.getDataBinding());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java
new file mode 100644
index 0000000000..1dc91374ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.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.databinding.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+
+public class DataBindingTestCase extends TestCase {
+ @SuppressWarnings("unused")
+ public void testDataType() throws Exception {
+ Class<Test> testClass = Test.class;
+ DataBinding d = testClass.getAnnotation(DataBinding.class);
+ Assert.assertEquals(d.value(), "sdo");
+
+ Method method = testClass.getMethod("test", new Class[] {Object.class});
+ DataBinding d2 = method.getAnnotation(DataBinding.class);
+ Assert.assertEquals(d2.value(), "jaxb");
+ }
+
+ @DataBinding("sdo")
+ private static interface Test {
+ @DataBinding("jaxb")
+ Object test(Object object);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java
new file mode 100755
index 0000000000..5e9fb52ccc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.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.databinding.impl;
+
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Edge;
+import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Vertex;
+
+public class DirectedGraphTestCase extends TestCase {
+ private DirectedGraph<String, Object> graph;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ graph = new DirectedGraph<String, Object>();
+ graph.addEdge("a", "b", null, 3);
+ graph.addEdge("b", "c", null, 1);
+ graph.addEdge("a", "c", null, 8);
+ graph.addEdge("a", "d", null, 3);
+ graph.addEdge("b", "d", null, 2);
+ graph.addEdge("c", "b", null, 1);
+ graph.addEdge("c", "d", null, 2);
+ graph.addEdge("d", "b", null, 1);
+ graph.addEdge("a", "e", null, 8);
+ graph.addEdge("c", "c", null, 2);
+ }
+
+ public void testGraph() {
+ // System.out.println(graph);
+
+ Vertex vertex = graph.getVertex("a");
+ Assert.assertNotNull(vertex);
+ Assert.assertEquals(vertex.getValue(), "a");
+
+ Assert.assertNull(graph.getVertex("1"));
+
+ Edge edge = graph.getEdge("a", "b");
+ Assert.assertNotNull(edge);
+ Assert.assertEquals(edge.getWeight(), 3);
+
+ edge = graph.getEdge("b", "a");
+ Assert.assertNull(edge);
+
+ DirectedGraph<String, Object>.Path path = graph.getShortestPath("a", "c");
+
+ List<DirectedGraph<String, Object>.Edge> edges = path.getEdges();
+ Assert.assertEquals(edges.size(), 2);
+ Assert.assertEquals(edges.get(0), graph.getEdge("a", "b"));
+ Assert.assertEquals(edges.get(1), graph.getEdge("b", "c"));
+
+ Assert.assertEquals(path.getWeight(), 4);
+
+ DirectedGraph<String, Object>.Path path2 = graph.getShortestPath("b", "e");
+ Assert.assertNull(path2);
+
+ DirectedGraph<String, Object>.Path path3 = graph.getShortestPath("a", "a");
+ Assert.assertTrue(path3.getWeight() == 0 && path3.getEdges().isEmpty());
+
+ DirectedGraph<String, Object>.Path path4 = graph.getShortestPath("c", "c");
+ Assert.assertTrue(path4.getWeight() == 2 && path4.getEdges().size() == 1);
+
+ // System.out.println(path);
+
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
new file mode 100644
index 0000000000..6fb022b2f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.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.sca.databinding.impl;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformationContext;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.xml.Node2String;
+import org.apache.tuscany.sca.databinding.xml.Node2Writer;
+import org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;
+import org.apache.tuscany.sca.databinding.xml.String2SAX;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for MediatorImpl
+ */
+public class MediatorImplTestCase 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 MediatorImpl mediator;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint();
+ TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint(dataBindingRegistry);
+
+ registry.addTransformer(new String2SAX());
+ registry.addTransformer(new SAX2DOMPipe());
+ registry.addTransformer(new Node2String());
+ registry.addTransformer(new Node2Writer());
+
+ mediator = new MediatorImpl(dataBindingRegistry, registry);
+ }
+
+ private TransformationContext createTransformationContext(Class sourceType, Class targetType) {
+ TransformationContext context = new TransformationContextImpl();
+ DataType sourceDataType = new DataTypeImpl<Class>(sourceType.getName(), sourceType, sourceType);
+ DataType targetDataType = new DataTypeImpl<Class>(targetType.getName(), targetType, targetType);
+ context.setSourceDataType(sourceDataType);
+ context.setTargetDataType(targetDataType);
+ return context;
+ }
+
+ public void testTransform1() {
+ TransformationContext context = createTransformationContext(String.class, Node.class);
+ Object node =
+ mediator.mediate(IPO_XML, context.getSourceDataType(), context.getTargetDataType(), null);
+ Assert.assertTrue(node instanceof Document);
+ Element root = ((Document)node).getDocumentElement();
+ Assert.assertEquals(root.getNamespaceURI(), "http://www.example.com/IPO");
+ Assert.assertEquals(root.getLocalName(), "purchaseOrder");
+ }
+
+ public void testTransform2() {
+ TransformationContext context = createTransformationContext(String.class, Writer.class);
+ Writer writer = new StringWriter();
+ mediator.mediate(IPO_XML, writer, context.getSourceDataType(), context.getTargetDataType(), null);
+ String str = writer.toString();
+ Assert.assertTrue(str != null && str.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java
new file mode 100644
index 0000000000..5e4f6a72df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.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.sca.databinding.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+
+import java.util.List;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.Transformer;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+
+/**
+ *
+ */
+public class TransformerRegistryImplTestCase extends TestCase {
+ private TransformerExtensionPoint registry;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new DefaultTransformerExtensionPoint(null);
+ }
+
+ public void testRegisterTransformer1() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testRegisterTransformerTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ expect(transformer.getSourceDataBinding()).andReturn("a");
+ expect(transformer.getTargetDataBinding()).andReturn("b");
+ expect(transformer.getWeight()).andReturn(10);
+ replay(transformer);
+ registry.addTransformer(transformer);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertSame(t, transformer);
+ }
+
+ public void testUnregisterTransformer() {
+ Transformer transformer = createMock(Transformer.class);
+ registry.addTransformer("a", "b", 10, transformer);
+ boolean result = registry.removeTransformer("a", "b");
+ Assert.assertTrue(result);
+ Transformer t = registry.getTransformer("a", "b");
+ Assert.assertNull(t);
+ }
+
+ public void testGetTransformerChain() {
+ Transformer t1 = createMock(Transformer.class);
+ expect(t1.getSourceDataBinding()).andReturn("a");
+ expect(t1.getTargetDataBinding()).andReturn("b");
+ expect(t1.getWeight()).andReturn(10);
+ replay(t1);
+ Transformer t2 = createMock(Transformer.class);
+ expect(t2.getSourceDataBinding()).andReturn("b");
+ expect(t2.getTargetDataBinding()).andReturn("c");
+ expect(t2.getWeight()).andReturn(20);
+ replay(t2);
+
+ Transformer t3 = createMock(Transformer.class);
+ expect(t3.getSourceDataBinding()).andReturn("a");
+ expect(t3.getTargetDataBinding()).andReturn("c");
+ expect(t3.getWeight()).andReturn(120);
+ replay(t3);
+
+ registry.addTransformer(t1);
+ registry.addTransformer(t2);
+ registry.addTransformer(t3);
+
+ List<Transformer> l1 = registry.getTransformerChain("a", "b");
+ Assert.assertTrue(l1.size() == 1 && l1.get(0) == t1);
+ List<Transformer> l2 = registry.getTransformerChain("a", "c");
+ Assert.assertTrue(l2.size() == 2 && l2.get(0) == t1 && l2.get(1) == t2);
+ List<Transformer> l3 = registry.getTransformerChain("a", "d");
+ Assert.assertNull(l3);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
new file mode 100644
index 0000000000..d5e90f0450
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Node;
+
+public class DOM2StAXTestCase 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 CRAZY_XML =
+ "<p:e1 xmlns=\"http://ns0\" xmlns:p=\"http://p1\">"
+ + "<p:e2 xmlns:p=\"http://p2\"/><e3/><e4 xmlns=\"\">E4</e4></p:e1>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(IPO_XML, null);
+ Node2XMLStreamReader t2 = new Node2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(node, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+ public void testTransformation2() {
+ String2Node t1 = new String2Node();
+ Node node = t1.transform(CRAZY_XML, null);
+ Node2XMLStreamReader t2 = new Node2XMLStreamReader();
+ XMLStreamReader reader = t2.transform(node, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ System.out.println(xml);
+ assertTrue(xml.contains("<p:e2 xmlns:p=\"http://p2\""));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
new file mode 100644
index 0000000000..5c67fa5d2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.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.databinding.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Test case for DataPipe
+ */
+public class DataPipeTestCase extends TestCase {
+
+ public final void testStreamPipe() throws IOException {
+ byte[] bytes = new byte[] {1, 2, 3};
+ StreamDataPipe pipe = new StreamDataPipe();
+ Assert.assertSame(OutputStream.class, pipe.getSourceType());
+ Assert.assertSame(InputStream.class, pipe.getTargetType());
+ OutputStream os = pipe.getSink();
+ os.write(bytes);
+ byte[] newBytes = new byte[16];
+ int count = pipe.getResult().read(newBytes);
+ Assert.assertEquals(3, count);
+ for (int i = 0; i < bytes.length; i++) {
+ Assert.assertEquals(bytes[i], newBytes[i]);
+ }
+ }
+
+ public final void testWriter2ReaderPipe() throws IOException {
+ String str = "ABC";
+ Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
+ Assert.assertSame(Writer.class, pipe.getSourceType());
+ Assert.assertSame(Reader.class, pipe.getTargetType());
+ pipe.getSink().write(str);
+ char[] buf = new char[16];
+ int count = pipe.getResult().read(buf);
+ Assert.assertEquals(3, count);
+ for (int i = 0; i < str.length(); i++) {
+ Assert.assertEquals(str.charAt(i), buf[i]);
+ }
+ }
+
+ public final void testPiped() throws Exception {
+ Node2Writer node2Writer = new Node2Writer();
+ Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
+ PipedTransformer<Node, Writer, Reader> transformer =
+ new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
+ Document document = DOMHelper.newDocument();
+ Element element = document.createElementNS("http://ns1", "root");
+ document.appendChild(element);
+ Reader reader = transformer.transform(document, null);
+ Assert.assertEquals(transformer.getWeight(), node2Writer.getWeight() + pipe.getWeight());
+ Assert.assertEquals(transformer.getSourceDataBinding(), node2Writer.getSourceDataBinding());
+ Assert.assertEquals(transformer.getTargetDataBinding(), pipe.getTargetDataBinding());
+ char[] buf = new char[120];
+ int count = reader.read(buf);
+ String xml = new String(buf, 0, count);
+ Assert.assertTrue(xml.contains("<root xmlns=\"http://ns1\"/>"));
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
new file mode 100644
index 0000000000..06bd0f5af6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.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.sca.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReader;
+
+public class JavaBean2XMLStreamReaderTestCase extends TestCase {
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ JavaBean2XMLStreamReader t2 = new JavaBean2XMLStreamReader();
+ MyBean bean = new MyBean();
+ bean.str = "ABC";
+ bean.i = 1;
+ bean.arr = new long[] {1, 2, 3};
+ bean.bean = new AnotherBean();
+ bean.bean.setName("Name");
+ XMLStreamReader reader = t2.transform(bean, null);
+ XMLStreamReader2String t3 = new XMLStreamReader2String();
+ String xml = t3.transform(reader, null);
+ assertTrue(xml.contains("<JavaBean2XMLStreamReaderTestCase$MyBean>"
+ + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean>"
+ + "<i>1</i><str>ABC</str></JavaBean2XMLStreamReaderTestCase$MyBean>"));
+ }
+
+ private static class MyBean {
+ private String str;
+ private int i;
+ private long arr[];
+ private AnotherBean bean;
+
+ /**
+ * @return the arr
+ */
+ public long[] getArr() {
+ return arr;
+ }
+
+ /**
+ * @param arr the arr to set
+ */
+ public void setArr(long[] arr) {
+ this.arr = arr;
+ }
+
+ /**
+ * @return the i
+ */
+ public int getI() {
+ return i;
+ }
+
+ /**
+ * @param i the i to set
+ */
+ public void setI(int i) {
+ this.i = i;
+ }
+
+ /**
+ * @return the str
+ */
+ public String getStr() {
+ return str;
+ }
+
+ /**
+ * @param str the str to set
+ */
+ public void setStr(String str) {
+ this.str = str;
+ }
+
+ /**
+ * @return the bean
+ */
+ public AnotherBean getBean() {
+ return bean;
+ }
+
+ /**
+ * @param bean the bean to set
+ */
+ public void setBean(AnotherBean bean) {
+ this.bean = bean;
+ }
+
+ }
+
+ private static class AnotherBean {
+ private String name;
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
new file mode 100755
index 0000000000..3627b2d094
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.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.databinding.xml;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.DOMHelper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class Node2StringTestCase extends TestCase {
+ public void testTransformation() throws Exception {
+ Document document = DOMHelper.newDocument();
+ Element element = document.createElementNS("http://ns1", "test");
+ document.appendChild(element);
+
+ new Node2String().transform(document, null);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
new file mode 100644
index 0000000000..30814bfc85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+public class PushTransformationTestCase 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>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testTransformation() {
+ String2XMLStreamReader t1 = new String2XMLStreamReader();
+ XMLStreamReader reader = t1.transform(IPO_XML, null);
+ XMLStreamReader2SAX t2 = new XMLStreamReader2SAX();
+ PipedTransformer<XMLStreamReader, ContentHandler, Node> t3 =
+ new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
+ Node node = t3.transform(reader, null);
+ Assert.assertNotNull(node);
+ Node2String t4 = new Node2String();
+ String xml = t4.transform(node, null);
+ Assert.assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java
new file mode 100644
index 0000000000..df04936dae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.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.databinding.xml;
+
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+/**
+ * Test Case for StAXHelper
+ */
+public class StAXHelperTestCase extends TestCase {
+ private static final String XML =
+ "<a:foo xmlns:a='http://a' name='foo'><bar name='bar'>" + "<doo a:name='doo' xmlns:a='http://doo'/>"
+ + "</bar></a:foo>";
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public void testHelper() throws Exception {
+ XMLStreamReader reader = StAXHelper.createXMLStreamReader(XML);
+ String xml = StAXHelper.save(reader);
+ reader = StAXHelper.createXMLStreamReader(xml);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
new file mode 100644
index 0000000000..fec4df7621
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.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.sca.databinding.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Node;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ *
+ */
+public class TraxTransformerTestCase extends TestCase {
+ private URL url;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ url = getClass().getResource("foo.xml");
+ }
+
+ public void testTransformDOM() throws IOException {
+ InputStream is = url.openStream();
+ InputStream2Node t1 = new InputStream2Node();
+ Node node = t1.transform(is, null);
+ is.close();
+ Writer writer = new StringWriter();
+ Node2Writer t2 = new Node2Writer();
+ t2.transform(node, writer, null);
+ String str = writer.toString();
+ StringReader reader = new StringReader(str);
+ Reader2Node t3 = new Reader2Node();
+ node = t3.transform(reader, null);
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ Node2OutputStream t4 = new Node2OutputStream();
+ t4.transform(node, os, null);
+ InputSource inputSource = new InputSource(new ByteArrayInputStream(os.toByteArray()));
+ InputSource2Node t5 = new InputSource2Node();
+ node = t5.transform(inputSource, null);
+ }
+
+ public void testTransformSAX() throws IOException {
+ MyContentHandler handler = new MyContentHandler();
+ InputStream is = url.openStream();
+ InputStream2SAX t1 = new InputStream2SAX();
+ t1.transform(is, handler, null);
+ is.close();
+
+ String xml = "<foo xmlns=\"http://foo\">bar</foo>";
+
+ InputSource inputSource = new InputSource(new StringReader(xml));
+ InputSource2SAX t2 = new InputSource2SAX();
+ MyContentHandler handler2 = new MyContentHandler();
+ t2.transform(inputSource, handler2, null);
+
+ }
+
+ private static class MyContentHandler extends DefaultHandler {
+
+ @Override
+ public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
+ throws SAXException {
+ super.startElement(namespaceURI, localName, qName, atts);
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd
new file mode 100644
index 0000000000..92a576fb98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl
new file mode 100644
index 0000000000..100890e10b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl
@@ -0,0 +1,76 @@
+<?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="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
+ xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
+ <element name="checkOrderStatus">
+ <complexType>
+ <sequence>
+ <element name="customerId" type="string" />
+ <element name="order" type="ipo:PurchaseOrderType" />
+ <element name="flag" type="int" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="checkOrderStatusResponse">
+ <complexType>
+ <sequence>
+ <element name="status" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="note" type="string" />
+ </schema>
+ </types>
+
+ <message name="CheckOrderStatusInput1">
+ <part name="body" element="xsd1:checkOrderStatus" />
+ </message>
+
+ <message name="CheckOrderStatusOutput1">
+ <part name="body" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <message name="CheckOrderStatusInput2">
+ <part name="p1" element="xsd1:checkOrderStatus" />
+ <part name="p2" element="xsd1:note" />
+ </message>
+
+ <message name="CheckOrderStatusOutput2">
+ <part name="p1" element="xsd1:checkOrderStatusResponse" />
+ </message>
+
+ <portType name="OrderPortType">
+ <operation name="checkOrderStatus">
+ <input message="tns:CheckOrderStatusInput1" />
+ <output message="tns:CheckOrderStatusOutput1" />
+ </operation>
+ <operation name="checkOrderStatus2">
+ <input message="tns:CheckOrderStatusInput2" />
+ <output message="tns:CheckOrderStatusOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml
new file mode 100644
index 0000000000..0ba8ade1e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml
@@ -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.
+-->
+<f:foo xmlns:f="http://foo" name="foo">
+ <b:bar xmlns:b="http://bar">bar</b:bar>
+</f:foo> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.checkstyle
new file mode 100644
index 0000000000..ea05637a07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.pmd
new file mode 100644
index 0000000000..aa1ce3e754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.pmd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.ruleset
new file mode 100644
index 0000000000..a7ff3be272
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/.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/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/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/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/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/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/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/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/pom.xml
new file mode 100644
index 0000000000..b712bff7ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/pom.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <name>Apache Tuscany Embedded Runtime Host</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
new file mode 100644
index 0000000000..dac8d6ce7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A handle to an SCA domain.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class SCADomain {
+
+ final static String LOCAL_DOMAIN_URI = "http://localhost";
+
+ /**
+ * Static variable to hold the most recent instance of SCADomain
+ */
+ // TODO: Temporary support for SCADomain.connect() API
+ private static SCADomain theDomain;
+
+
+ /**
+ * Returns a new instance of a local SCA domain.
+ *
+ * @return
+ */
+ public static SCADomain newInstance() {
+ return createNewInstance(LOCAL_DOMAIN_URI, null);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composite will be included in the SCA domain.
+ *
+ * @param composite the deployable composite to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String composite) {
+ return createNewInstance(LOCAL_DOMAIN_URI, "/", composite);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composites will be included in the SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain
+ * @param contributionLocation the location of an SCA contribution
+ * @param composites the deployable composites to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String domainURI, String contributionLocation, String... composites) {
+ return createNewInstance(domainURI, contributionLocation, composites);
+ }
+
+ /**
+ * Removes the specified local SCA Domain instance
+ *
+ * @param domainInstance the instance to be removed
+ */
+ // FIXME: Adding this as temporary support for the "connect" API
+ public static void removeInstance(SCADomain domainInstance) {
+ theDomain = null;
+ }
+
+ /**
+ * Returns an SCADomain representing a remote SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain
+ * @return
+ */
+ // FIXME : this is a temporary implementation to get the capability working
+ public static SCADomain connect(String domainURI) {
+ return theDomain;
+ }
+
+ /**
+ * Close the SCA domain.
+ */
+ public void close() {
+ // TODO: temporary to support initial SCADomain.connect capability
+ SCADomain.removeInstance(this);
+ }
+
+ /**
+ * Returns the URI of the SCA Domain.
+ *
+ * @return the URI of the SCA Domain
+ */
+ public abstract String getURI();
+
+ /**
+ * Cast a type-safe reference to a CallableReference. Converts a type-safe
+ * reference to an equivalent CallableReference; if the target refers to a
+ * service then a ServiceReference will be returned, if the target refers to
+ * a callback then a CallableReference will be returned.
+ *
+ * @param target a reference proxy provided by the SCA runtime
+ * @param <B> the Java type of the business interface for the reference
+ * @param <R> the type of reference to be returned
+ * @return a CallableReference equivalent for the proxy
+ * @throws IllegalArgumentException if the supplied instance is not a
+ * reference supplied by the SCA runtime
+ */
+ public abstract <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public abstract <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public abstract <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Read the service name from a configuration file
+ *
+ * @param classLoader
+ * @param name The name of the service class
+ * @return A class name which extends/implements the service class
+ * @throws IOException
+ */
+ private static String getServiceName(ClassLoader classLoader, String name) throws IOException {
+ InputStream is = classLoader.getResourceAsStream("META-INF/services/" + name);
+ if (is == null) {
+ return null;
+ }
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ } else if (!line.startsWith("#")) {
+ return line.trim();
+ }
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns an SCADomain instance. If the system property
+ * "org.apache.tuscany.sca.host.embedded.SCADomain" is set, its value is used as
+ * the name of the implementation class. Otherwise, if the resource
+ * "META-INF/services/org.apache.tuscany.sca.host.embedded.SCADomain" can be
+ * loaded from the supplied classloader. Otherwise, it will use
+ * "org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain" as the default.
+ * The named class is loaded from the supplied classloader.
+ *
+ * @param classLoader
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ * @return
+ */
+ static SCADomain createNewInstance(String domainURI, String contributionLocation, String... composites) {
+
+ SCADomain domain = null;
+
+ try {
+ // Determine the runtime and application classloader
+ final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
+ final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();
+
+ // Discover the SCADomain implementation
+ final String name = SCADomain.class.getName();
+ String className = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty(name);
+ }
+ });
+
+ if (className == null) {
+ className = getServiceName(runtimeClassLoader, name);
+ }
+
+ if (className == null) {
+
+ // Create a default SCA domain implementation
+ domain =
+ new DefaultSCADomain(runtimeClassLoader,
+ applicationClassLoader,
+ domainURI,
+ contributionLocation,
+ composites);
+ } else {
+
+ // Create an instance of the discovered SCA domain implementation
+ Class cls = Class.forName(className, true, runtimeClassLoader);
+ Constructor<?> constructor = null;
+ try {
+ constructor = cls.getConstructor(ClassLoader.class, ClassLoader.class,
+ String.class, String.class, String[].class);
+ } catch (NoSuchMethodException e) {}
+ if (constructor != null) {
+ domain = (SCADomain)constructor.newInstance(runtimeClassLoader,
+ applicationClassLoader,
+ domainURI,
+ contributionLocation,
+ composites);
+ } else {
+
+ constructor = cls.getConstructor(ClassLoader.class, String.class);
+ domain = (SCADomain)constructor.newInstance(runtimeClassLoader, domainURI);
+ }
+ }
+
+ // FIXME: temporary support for connect() API
+ theDomain = domain;
+
+ return domain;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java
new file mode 100644
index 0000000000..5dd3803ed2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.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.sca.host.embedded;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+
+public class SCADomainBean extends SCADomain {
+
+ private SCADomain instance;
+
+ private String uri = LOCAL_DOMAIN_URI;
+ private String location = "/";
+ private String[] composites;
+
+ /**
+ * Constructs a new SCA domain
+ */
+ public SCADomainBean() {
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public void setContributionLocation(String contributionLocation) {
+ this.location = contributionLocation;
+ }
+
+ public String getContributionLocation() {
+ return location;
+ }
+
+ public void setDeployableComposite(String composite) {
+ setDeployableComposites(composite);
+ }
+
+ public void setDeployableComposites(String... composites) {
+ this.composites = composites;
+ }
+
+ public String[] getDeployableComposites() {
+ return composites;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ Object result = instance.cast(target);
+ return (R) result;
+ }
+
+ @Override
+ public void close() {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ instance.close();
+ instance = null;
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getService(businessInterface, serviceName);
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
+ if (instance == null) {
+ instance = SCADomain.createNewInstance(uri, location, composites);
+ }
+ return instance.getServiceReference(businessInterface, referenceName);
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+
+ // Make sure that the SCA domain is closed
+ if (instance != null) {
+ instance.close();
+ instance = null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
new file mode 100644
index 0000000000..c133bad38e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+/**
+ * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SCATestCaseRunner {
+
+ private ClassLoader classLoader;
+ private Class<?> testSuiteClass;
+ private Object testSuite;
+ private Class<?> testResultClass;
+ private Class<?> testCaseClass;
+ private Object testCase;
+
+ private Class<?> beforeAnnotation;
+ private Class<?> beforeClassAnnotation;
+ private Class<?> afterAnnotation;
+ private Class<?> afterClassAnnotation;
+ private Class<?> junit4AdapterClass;
+ private Class<?> junit3TestCaseClass;
+
+ /**
+ * Constructs a new TestCase runner.
+ *
+ * @param testClass
+ */
+ public SCATestCaseRunner(Class testClass) {
+ try {
+ classLoader = (URLClassLoader)testClass.getClassLoader();
+ if (classLoader instanceof URLClassLoader) {
+ URL[] urls = ((URLClassLoader)classLoader).getURLs();
+ classLoader = new URLClassLoader(urls, classLoader.getParent());
+ } else {
+ classLoader = new URLClassLoader(new URL[0], classLoader);
+ }
+
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ testCaseClass = Class.forName(testClass.getName(), true, classLoader);
+ testCase = testCaseClass.newInstance();
+
+ junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, classLoader);
+
+ testSuiteClass = Class.forName("junit.framework.TestSuite", true, classLoader);
+ Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
+ testSuite = testSuiteConstructor.newInstance(testCaseClass);
+
+ testResultClass = Class.forName("junit.framework.TestResult", true, classLoader);
+
+ try {
+ beforeAnnotation = Class.forName("org.junit.Before", true, classLoader);
+ afterAnnotation = Class.forName("org.junit.After", true, classLoader);
+ beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, classLoader);
+ afterClassAnnotation = Class.forName("org.junit.AfterClass", true, classLoader);
+ junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, classLoader);
+ } catch (Exception e) {
+ // Unexpected
+ throw new AssertionError(e);
+ }
+
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Run the test case
+ */
+ public void run() {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) {
+ Object testResult = testResultClass.newInstance();
+ Method runMethod = testSuiteClass.getMethod("run", testResultClass);
+ runMethod.invoke(testSuite, testResult);
+ } else {
+ Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass);
+ Object testResult = testResultClass.newInstance();
+ Method runMethod = junit4AdapterClass.getMethod("run", testResultClass);
+ runMethod.invoke(junit4Adapter, testResult);
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Invoke the setUp method
+ */
+ public void setUp() {
+ execute("setUp");
+ }
+
+ /**
+ * Invoke the before methods
+ */
+ public void before() {
+ execute(beforeAnnotation);
+ }
+
+ /**
+ * Invoke the beforeClass methods
+ */
+ public void beforeClass() {
+ execute(beforeClassAnnotation);
+ }
+
+ /**
+ * Invoke the tearDown method
+ */
+ public void tearDown() {
+ execute("tearDown");
+ }
+
+ /**
+ * Invoke the after methods
+ */
+ public void after() {
+ execute(afterAnnotation);
+ }
+
+ /**
+ * Invoke the afterClass methods
+ */
+ public void afterClass() {
+ execute(afterClassAnnotation);
+ }
+
+ /**
+ * Invoke the specified test method.
+ */
+ public void run(String methodName) {
+ execute(methodName);
+ }
+
+ /**
+ * Invoke the methods annotated with the specified annotation.
+ */
+ private void execute(Class<?> annotationClass) {
+ if (annotationClass == null) {
+ throw new RuntimeException(new NoSuchMethodException());
+ }
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+
+ for (Method method : testCaseClass.getDeclaredMethods()) {
+ for (Annotation annotation : method.getAnnotations()) {
+ if (annotation.annotationType() == annotationClass) {
+ method.invoke(testCase);
+ }
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+ /**
+ * Invoke the specified method
+ */
+ private void execute(String methodName) {
+ ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ Method setUpMethod = testCaseClass.getDeclaredMethod(methodName);
+ setUpMethod.setAccessible(true);
+ setUpMethod.invoke(testCase);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(tccl);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
new file mode 100644
index 0000000000..b2c33f81db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.runtime.ActivationException;
+import org.apache.tuscany.sca.core.runtime.CompositeActivator;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Constants;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A default SCA domain facade implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomain extends SCADomain {
+
+ private String uri;
+ private String location;
+ private String[] composites;
+ private Composite domainComposite;
+ private Contribution contribution;
+ private Map<String, Component> components = new HashMap<String, Component>();
+ private ReallySmallRuntime runtime;
+
+ /**
+ * Constructs a new domain facade.
+ *
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ */
+ public DefaultSCADomain(ClassLoader runtimeClassLoader,
+ ClassLoader applicationClassLoader,
+ String domainURI,
+ String contributionLocation,
+ String... composites) {
+ this.uri = domainURI;
+ this.location = contributionLocation;
+ this.composites = composites;
+
+ // Create and start the runtime
+ runtime = new ReallySmallRuntime(runtimeClassLoader);
+ try {
+ runtime.start();
+
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Contribute the given contribution to an in-memory repository
+ ContributionService contributionService = runtime.getContributionService();
+ URL contributionURL;
+ try {
+ contributionURL = getContributionLocation(applicationClassLoader, location, this.composites);
+ } catch (MalformedURLException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ try {
+ ModelResolverImpl modelResolver = new ModelResolverImpl(applicationClassLoader);
+ String contributionURI = FileHelper.getName(contributionURL.getPath());
+ contribution = contributionService.contribute(contributionURI, contributionURL, modelResolver, false);
+ } catch (ContributionException e) {
+ throw new ServiceRuntimeException(e);
+ } catch (IOException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA_NS, "domain"));
+ domainComposite.setURI(domainURI);
+
+ //when the deployable composites were specified when initializing the runtime
+ if (composites != null && composites.length > 0 && composites[0].length() > 0) {
+ // Include all specified deployable composites in the SCA domain
+ Map<String, Composite> compositeArtifacts = new HashMap<String, Composite>();
+ for (DeployedArtifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ compositeArtifacts.put(artifact.getURI(), (Composite)artifact.getModel());
+ }
+ }
+ for (String compositePath : composites) {
+ Composite composite = compositeArtifacts.get(compositePath);
+ if (composite == null) {
+ throw new ServiceRuntimeException("Composite not found: " + compositePath);
+ }
+ domainComposite.getIncludes().add(composite);
+ }
+ } else {
+ // in this case, a sca-contribution.xml should have been specified
+ for(Composite composite : contribution.getDeployables()) {
+ domainComposite.getIncludes().add(composite);
+ }
+
+ }
+
+
+ // Activate and start the SCA domain composite
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ try {
+ compositeActivator.activate(domainComposite);
+ compositeActivator.start(domainComposite);
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Index the top level components
+ for (Component component : domainComposite.getComponents()) {
+ components.put(component.getName(), component);
+ }
+ }
+
+ @Override
+ public void close() {
+
+ super.close();
+
+ // Remove the contribution from the in-memory repository
+ ContributionService contributionService = runtime.getContributionService();
+ try {
+ contributionService.remove(contribution.getURI());
+ } catch (ContributionException e) {
+ throw new ServiceRuntimeException(e);
+ }
+
+ // Stop the SCA domain composite
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ try {
+ compositeActivator.stop(domainComposite);
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+
+ }
+
+ // Stop the runtime
+ try {
+ runtime.stop();
+ } catch (ActivationException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Determine the location of a contribution, given a contribution path and a
+ * list of composites.
+ *
+ * @param contributionPath
+ * @param composites
+ * @param classLoader
+ * @return
+ * @throws MalformedURLException
+ */
+ private URL getContributionLocation(ClassLoader classLoader, String contributionPath, String[] composites)
+ throws MalformedURLException {
+ if (contributionPath != null && contributionPath.length() > 0) {
+ URI contributionURI = URI.create(contributionPath);
+ if (contributionURI.isAbsolute() || composites.length == 0) {
+ return new URL(contributionPath);
+ }
+ }
+
+ String contributionArtifactPath = null;
+ URL contributionArtifactURL = null;
+ if (composites != null && composites.length > 0 && composites[0].length() > 0) {
+
+ // Here the SCADomain was started with a reference to a composite file
+ contributionArtifactPath = composites[0];
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
+ }
+ } else {
+
+ // Here the SCADomain was started without any reference to a composite file
+ // We are going to look for an sca-contribution.xml or sca-contribution-generated.xml
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+
+ if( contributionArtifactURL == null ) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+
+ // Look for META-INF/sca-deployables
+ if (contributionArtifactURL == null) {
+ contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
+ contributionArtifactURL = classLoader.getResource(contributionArtifactPath);
+ }
+ }
+
+ if (contributionArtifactURL == null) {
+ throw new IllegalArgumentException("Can't determine contribution deployables. Either specify a composite file, or use an sca-contribution.xml file to specify the deployables.");
+ }
+
+ URL contributionURL = null;
+ // "jar:file://....../something.jar!/a/b/c/app.composite"
+ try {
+ String url = contributionArtifactURL.toExternalForm();
+ String protocol = contributionArtifactURL.getProtocol();
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (url.endsWith(contributionArtifactPath)) {
+ String location = url.substring(0, url.lastIndexOf(contributionArtifactPath));
+ // workaround from evil url/uri form maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = url.substring(4, url.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ } catch (MalformedURLException mfe) {
+ throw new IllegalArgumentException(mfe);
+ }
+
+ return contributionURL;
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component in the domain
+ Component component = components.get(componentName);
+ if (component == null) {
+ throw new ServiceRuntimeException("Component not found: " + componentName);
+ }
+ ComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite
+ // component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ ComponentService promotedService = null;
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ promotedService = compositeService.getPromotedService();
+ SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+ if (scaBinding != null) {
+ Component promotedComponent = scaBinding.getComponent();
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext = (ComponentContext)promotedComponent;
+ }
+ }
+ break;
+ }
+ }
+ if (componentContext == null) {
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ }
+ } else {
+ componentContext = (ComponentContext)component;
+ }
+
+ ServiceReference<B> serviceReference;
+ if (serviceName != null) {
+ serviceReference = componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ serviceReference = componentContext.createSelfReference(businessInterface);
+ }
+ return serviceReference;
+
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
new file mode 100644
index 0000000000..66de330321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.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.host.embedded.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.runtime.ActivationException;
+import org.apache.tuscany.sca.core.runtime.CompositeActivator;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.Constants;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * An SCA domain facade implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedSCADomain extends SCADomain {
+
+ private String uri;
+ private Composite domainComposite;
+ private ReallySmallRuntime runtime;
+ private Map<String, Component> components = new HashMap<String, Component>();
+ private DomainCompositeHelper domainCompositeHelper;
+
+ public class DomainCompositeHelper {
+
+ /**
+ * Add a composite to the domain
+ * @param composite
+ * @return
+ */
+ public Composite addComposite(Composite composite) throws ActivationException {
+ domainComposite.getIncludes().add(composite);
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.activate(composite);
+ for (Component component : composite.getComponents()) {
+ components.put(component.getName(), component);
+ }
+ return composite;
+ }
+
+ /**
+ * Remove a composite from the domain
+ * @param composite
+ * @throws ActivationException
+ */
+ public void removeComposite(Composite composite) throws ActivationException {
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.deactivate(composite);
+ domainComposite.getIncludes().remove(composite);
+ for (Component component : composite.getComponents()) {
+ components.remove(component.getName());
+ }
+ }
+
+ /**
+ * Start a composite
+ * @param composite
+ * @throws ActivationException
+ */
+ public void startComposite(Composite composite) throws ActivationException {
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.start(composite);
+ }
+
+ /**
+ * Stop a composite
+ * @param composite
+ * @throws ActivationException
+ */
+ public void stopComposite(Composite composite) throws ActivationException {
+ CompositeActivator compositeActivator = runtime.getCompositeActivator();
+ compositeActivator.stop(composite);
+ }
+ }
+
+ /**
+ * Constructs a new domain facade.
+ *
+ * @param runtimeClassLoader
+ * @param domainURI
+ */
+ public EmbeddedSCADomain(ClassLoader runtimeClassLoader,
+ String domainURI) {
+ this.uri = domainURI;
+
+ // Create a runtime
+ runtime = new ReallySmallRuntime(runtimeClassLoader);
+ }
+
+ public void start() throws ActivationException {
+
+ // Start the runtime
+ runtime.start();
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ domainComposite = assemblyFactory.createComposite();
+ domainComposite.setName(new QName(Constants.SCA_NS, "domain"));
+ domainComposite.setURI(uri);
+
+ // Create a domain composite helper
+ domainCompositeHelper = new DomainCompositeHelper();
+ }
+
+ public void stop() throws ActivationException {
+
+ // Stop the runtime
+ runtime.stop();
+
+ // Cleanup
+ domainComposite = null;
+ domainCompositeHelper = null;
+ }
+
+ public ContributionService getContributionService() {
+ return runtime.getContributionService();
+ }
+
+ public DomainCompositeHelper getDomainCompositeHelper() {
+ return domainCompositeHelper;
+ }
+
+ @Override
+ public void close() {
+ super.close();
+ }
+
+ @Override
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ @Override
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component in the domain
+ Component component = components.get(componentName);
+ if (component == null) {
+ throw new ServiceRuntimeException("Component not found: " + componentName);
+ }
+ ComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite
+ // component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ ComponentService promotedService = null;
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ promotedService = compositeService.getPromotedService();
+ SCABinding scaBinding = promotedService.getBinding(SCABinding.class);
+ if (scaBinding != null) {
+ Component promotedComponent = scaBinding.getComponent();
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext = (ComponentContext)promotedComponent;
+ }
+ }
+ break;
+ }
+ }
+ if (componentContext == null) {
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ }
+ } else {
+ componentContext = (ComponentContext)component;
+ }
+
+ ServiceReference<B> serviceReference;
+ if (serviceName != null) {
+ serviceReference = componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ serviceReference = componentContext.createSelfReference(businessInterface);
+ }
+ return serviceReference;
+
+ }
+
+ @Override
+ public String getURI() {
+ return uri;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
new file mode 100644
index 0000000000..6e2da9cd6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
@@ -0,0 +1,173 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.runtime.ActivationException;
+import org.apache.tuscany.sca.core.runtime.CompositeActivator;
+import org.apache.tuscany.sca.core.runtime.RuntimeAssemblyFactory;
+import org.apache.tuscany.sca.core.work.ThreadPoolWorkManager;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.scope.ScopeRegistry;
+
+public class ReallySmallRuntime {
+
+ private List<ModuleActivator> modules;
+ private ExtensionPointRegistry registry;
+
+ private ClassLoader classLoader;
+ private AssemblyFactory assemblyFactory;
+ private ContributionService contributionService;
+ private CompositeActivator compositeActivator;
+ private ThreadPoolWorkManager workManager;
+ private ScopeRegistry scopeRegistry;
+
+ public ReallySmallRuntime(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public void start() throws ActivationException {
+
+ // Create our extension point registry
+ registry = new DefaultExtensionPointRegistry();
+
+ // Create a work manager
+ workManager = new ThreadPoolWorkManager(10);
+
+ // Create an interface contract mapper
+ InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ // Create factory extension point
+ ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
+ registry.addExtensionPoint(factories);
+
+ // Create Message factory
+ MessageFactory messageFactory = new MessageFactoryImpl();
+ factories.addFactory(messageFactory);
+
+ // Create a proxy factory
+ ProxyFactory proxyFactory = ReallySmallRuntimeBuilder.createProxyFactory(registry, mapper, messageFactory);
+
+ // Create model factories
+ assemblyFactory = new RuntimeAssemblyFactory(mapper, proxyFactory);
+ factories.addFactory(assemblyFactory);
+ PolicyFactory policyFactory = new DefaultPolicyFactory();
+ factories.addFactory(policyFactory);
+ SCABindingFactory scaBindingFactory = new DefaultSCABindingFactory();
+ factories.addFactory(scaBindingFactory);
+
+ // Create a contribution service
+ contributionService = ReallySmallRuntimeBuilder.createContributionService(registry,
+ assemblyFactory,
+ policyFactory,
+ mapper);
+
+ // Create the ScopeRegistry
+ scopeRegistry = ReallySmallRuntimeBuilder.createScopeRegistry(registry);
+
+ // Create a composite activator
+ compositeActivator = ReallySmallRuntimeBuilder.createCompositeActivator(registry,
+ assemblyFactory,
+ scaBindingFactory,
+ mapper,
+ scopeRegistry,
+ workManager);
+
+ // Start the runtime modules
+ modules = startModules(registry, classLoader);
+
+ }
+
+ public void stop() throws ActivationException {
+
+ // Stop the runtime modules
+ stopModules(registry, modules);
+
+ // Stop and destroy the work manager
+ workManager.destroy();
+
+ // Cleanup
+ modules = null;
+ registry = null;
+ assemblyFactory = null;
+ contributionService = null;
+ compositeActivator = null;
+ workManager = null;
+ scopeRegistry = null;
+ }
+
+ public ContributionService getContributionService() {
+ return contributionService;
+ }
+
+ public CompositeActivator getCompositeActivator() {
+ return compositeActivator;
+ }
+
+ public AssemblyFactory getAssemblyFactory() {
+ return assemblyFactory;
+ }
+
+ @SuppressWarnings("unchecked")
+ private List<ModuleActivator> startModules(ExtensionPointRegistry registry, ClassLoader classLoader)
+ throws ActivationException {
+
+ // Load and instantiate the modules found on the classpath
+ List<ModuleActivator> modules = ReallySmallRuntimeBuilder.getServices(classLoader, ModuleActivator.class);
+ for (ModuleActivator module : modules) {
+ Object[] extensionPoints = module.getExtensionPoints();
+ if (extensionPoints != null) {
+ for (Object e : extensionPoints) {
+ registry.addExtensionPoint(e);
+ }
+ }
+ }
+
+ // Start all the extension modules
+ for (ModuleActivator activator : modules) {
+ activator.start(registry);
+ }
+
+ return modules;
+ }
+
+ private void stopModules(ExtensionPointRegistry registry, List<ModuleActivator> modules) {
+ for (ModuleActivator module : modules) {
+ module.stop(registry);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
new file mode 100644
index 0000000000..7bf868f3fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
@@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.host.embedded.impl;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+import org.apache.tuscany.sca.contribution.processor.DefaultPackageProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
+import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
+import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
+import org.apache.tuscany.sca.core.invocation.JDKProxyService;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.runtime.ActivationException;
+import org.apache.tuscany.sca.core.runtime.CompositeActivator;
+import org.apache.tuscany.sca.core.runtime.CompositeActivatorImpl;
+import org.apache.tuscany.sca.core.runtime.RuntimeSCABindingProviderFactory;
+import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
+import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
+import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
+import org.apache.tuscany.sca.core.work.Jsr237WorkScheduler;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.DefaultProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+import org.apache.tuscany.sca.runtime.DefaultWireProcessorExtensionPoint;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
+import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
+import org.apache.tuscany.sca.scope.ScopeContainerFactory;
+import org.apache.tuscany.sca.scope.ScopeRegistry;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+import commonj.work.WorkManager;
+
+public class ReallySmallRuntimeBuilder {
+
+ public static ProxyFactory createProxyFactory(ExtensionPointRegistry registry, InterfaceContractMapper mapper, MessageFactory messageFactory) {
+
+ // Create a proxy factory
+ ProxyFactory proxyFactory = new JDKProxyService(messageFactory, mapper);
+
+ // FIXME remove this
+ registry.addExtensionPoint(proxyFactory);
+ registry.addExtensionPoint(mapper);
+
+ return proxyFactory;
+ }
+
+ public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
+ AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ InterfaceContractMapper mapper,
+ ScopeRegistry scopeRegistry,
+ WorkManager workManager) {
+
+ // Create a work scheduler
+ WorkScheduler workScheduler = new Jsr237WorkScheduler(workManager);
+ registry.addExtensionPoint(workScheduler);
+
+ // Create a wire post processor extension point
+ RuntimeWireProcessorExtensionPoint wireProcessors = new DefaultWireProcessorExtensionPoint();
+ registry.addExtensionPoint(wireProcessors);
+ RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
+
+ // Create a provider factory extension point
+ ProviderFactoryExtensionPoint providerFactories = new DefaultProviderFactoryExtensionPoint();
+ registry.addExtensionPoint(providerFactories);
+ providerFactories.addProviderFactory(new RuntimeSCABindingProviderFactory());
+
+ // Create the composite activator
+ CompositeActivator compositeActivator = new CompositeActivatorImpl(
+ assemblyFactory, scaBindingFactory,
+ mapper, scopeRegistry,
+ workScheduler, wireProcessor,
+ providerFactories);
+
+ return compositeActivator;
+ }
+
+ /**
+ * Create the contribution service used by this domain.
+ *
+ * @throws ActivationException
+ */
+ public static ContributionService createContributionService(ExtensionPointRegistry registry,
+ AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ InterfaceContractMapper mapper)
+ throws ActivationException {
+
+ XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+
+ // Create STAX artifact processor extension point
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ registry.addExtensionPoint(staxProcessors);
+
+ // Create and register STAX processors for SCA assembly XML
+ ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, xmlFactory,
+ XMLOutputFactory
+ .newInstance());
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(assemblyFactory, policyFactory, mapper,
+ staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+ staxProcessors
+ .addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+
+ // Create URL artifact processor extension point
+ // FIXME use the interface instead of the class
+ DefaultURLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
+ registry.addExtensionPoint(documentProcessors);
+
+ // Create and register document processors for SCA assembly XML
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+ documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+
+ // Create contribution package processor extension point
+ PackageTypeDescriberImpl describer = new PackageTypeDescriberImpl();
+ PackageProcessorExtensionPoint packageProcessors = new DefaultPackageProcessorExtensionPoint();
+ PackageProcessor packageProcessor = new ExtensiblePackageProcessor(packageProcessors, describer);
+ registry.addExtensionPoint(packageProcessors);
+
+ // Register base package processors
+ packageProcessors.addPackageProcessor(new JarContributionProcessor());
+ packageProcessors.addPackageProcessor(new FolderContributionProcessor());
+
+ // Create a contribution repository
+ ContributionRepository repository;
+ try {
+ repository = new ContributionRepositoryImpl("target");
+ } catch (IOException e) {
+ throw new ActivationException(e);
+ }
+
+ ContributionFactory contributionFactory = new ContributionFactoryImpl();
+ ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+ ContributionService contributionService = new ContributionServiceImpl(repository, packageProcessor,
+ documentProcessor, assemblyFactory,
+ contributionFactory, xmlFactory);
+ return contributionService;
+ }
+
+ public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
+ ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
+ ScopeContainerFactory[] factories = new ScopeContainerFactory[] {new CompositeScopeContainerFactory(),
+ new StatelessScopeContainerFactory(),
+ new RequestScopeContainerFactory(),
+ // new ConversationalScopeContainer(monitor),
+ // new HttpSessionScopeContainer(monitor)
+ };
+ for (ScopeContainerFactory f : factories) {
+ scopeRegistry.register(f);
+ }
+
+ registry.addExtensionPoint(scopeRegistry);
+
+ return scopeRegistry;
+ }
+
+ /**
+ * Read the service name from a configuration file
+ *
+ * @param classLoader
+ * @param name The name of the service class
+ * @return A class name which extends/implements the service class
+ * @throws IOException
+ */
+ private static Set<String> getServiceClassNames(ClassLoader classLoader, String name) throws IOException {
+ Set<String> set = new HashSet<String>();
+ Enumeration<URL> urls = classLoader.getResources("META-INF/services/" + name);
+ while (urls.hasMoreElements()) {
+ URL url = urls.nextElement();
+ Set<String> service = getServiceClassNames(url);
+ if (service != null) {
+ set.addAll(service);
+
+ }
+ }
+ return set;
+ }
+
+ private static Set<String> getServiceClassNames(URL url) throws IOException {
+ Set<String> names = new HashSet<String>();
+ InputStream is = url.openStream();
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ }
+ line = line.trim();
+ if (!line.startsWith("#") && !"".equals(line)) {
+ names.add(line.trim());
+ }
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+
+ if (is != null){
+ try {
+ is.close();
+ } catch( IOException ioe) {
+ //ignore
+ }
+ }
+ }
+ return names;
+ }
+
+ public static <T> List<T> getServices(final ClassLoader classLoader, Class<T> serviceClass) {
+ List<T> instances = new ArrayList<T>();
+ try {
+ Set<String> services = getServiceClassNames(classLoader, serviceClass.getName());
+ for (String className : services) {
+ Class cls = Class.forName(className, true, classLoader);
+ instances.add(serviceClass.cast(cls.newInstance()));
+ }
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ return instances;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUD.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUD.java
new file mode 100644
index 0000000000..e33396adfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUD.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 crud;
+
+/**
+ * The service interface of the single CRUD service provided by CRUD components.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CRUD {
+
+ /**
+ * Create a new resource.
+ * @param resource
+ * @return
+ */
+ String create(Object resource);
+
+ /**
+ * Retrieve a resource.
+ * @param id
+ * @return
+ */
+ Object retrieve(String id);
+
+ /**
+ * Update a resource.
+ * @param id
+ * @param resource
+ * @return
+ */
+ Object update(String id, Object resource);
+
+ /**
+ * Delete a resource.
+ * @param id
+ */
+ void delete(String id);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..1f156c3261
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementation.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 crud;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public interface CRUDImplementation extends Implementation {
+
+ /**
+ * Returns the directory used by CRUD implementations to persist resources.
+ *
+ * @return the directory used to persist resources
+ */
+ public String getDirectory();
+
+ /**
+ * Sets the directory used by CRUD implementations to persist resources.
+ *
+ * @param directory the directory used to persist resources
+ */
+ public void setDirectory(String directory);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementationFactory.java
new file mode 100644
index 0000000000..430754a8b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/CRUDImplementationFactory.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 crud;
+
+/**
+ * A factory for the sample CRUD implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface CRUDImplementationFactory {
+
+ /**
+ * Creates a new CRUD implementation.
+ *
+ * @return
+ */
+ CRUDImplementation createCRUDImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.java
new file mode 100644
index 0000000000..3cc3482bd7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/DefaultCRUDImplementationFactory.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 crud;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+
+import crud.impl.CRUDImplementationImpl;
+
+/**
+ * A default factory for the CRUD implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultCRUDImplementationFactory implements CRUDImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector introspector;
+
+ public DefaultCRUDImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ public CRUDImplementation createCRUDImplementation() {
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory, introspector);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/backend/ResourceManager.java
new file mode 100644
index 0000000000..fc6bffa9d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/backend/ResourceManager.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 crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import crud.CRUD;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceManager implements CRUD {
+ private static int counter;
+ private static final Map<String, Object> store = new HashMap<String, Object>();
+ private String directory;
+
+ /**
+ * Constructs a new resource manager.
+ *
+ * @param directory the directory where to persist resources
+ */
+ public ResourceManager(String directory) {
+ super();
+ this.directory = directory;
+ }
+
+ /**
+ * Creates a new resource.
+ *
+ * @param resource
+ * @return
+ */
+ public String createResource(Object resource) {
+ System.out.println("create(" + resource + ") in " + directory);
+ String key = String.valueOf(counter++);
+ store.put(key, resource);
+ return key;
+ }
+
+ /**
+ * Deletes a resource.
+ *
+ * @param id
+ */
+ public void deleteResource(String id) {
+ System.out.println("delete(" + id + ")");
+ store.remove(id);
+ }
+
+ /**
+ * Retrieves a resource.
+ *
+ * @param id
+ * @return
+ */
+ public Object retrieveResource(String id) {
+ System.out.println("retrieve(" + id + ")");
+ return store.get(id);
+ }
+
+ /**
+ * Updates a resource.
+ *
+ * @param id
+ * @param resource
+ * @return
+ */
+ public Object updateResource(String id, Object resource) {
+ System.out.println("update(" + id + ")");
+ return store.put(id, resource);
+ }
+
+ //FIXME We shouldn't have to implement the CRUD interface here
+
+ public String create(Object resource) {
+ return createResource(resource);
+ }
+
+ public Object retrieve(String id) {
+ return retrieveResource(id);
+ }
+
+ public Object update(String id, Object resource) {
+ return updateResource(id, resource);
+ }
+
+ public void delete(String id) {
+ deleteResource(id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.java
new file mode 100644
index 0000000000..5bc3a0204c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationImpl.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 crud.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import crud.CRUD;
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class CRUDImplementationImpl implements CRUDImplementation {
+
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+
+ // CRUD implementation always provide a single service exposing
+ // the CRUD interface, and have no references and properties
+ crudService = assemblyFactory.createService();
+ crudService.setName("CRUD");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = introspector.introspect(CRUD.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ crudService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample CRUD implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample CRUD implementation provides a single fixed CRUD service
+ return Collections.singletonList(crudService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample CRUD implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample CRUD implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample CRUD implementation does not have a URI
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample CRUD implementation does not support policy sets
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample CRUD implementation does not support intents
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample CRUD implementation does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // The sample CRUD implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample CRUD implementation is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.java
new file mode 100644
index 0000000000..32b9a6be84
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/impl/CRUDImplementationProcessor.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 crud.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_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.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 crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+/**
+ * Implements a STAX artifact processor for CRUD implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.crud>
+ * elements in SCA assembly XML composite files and populating the CRUD
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CRUDImplementationProcessor implements StAXArtifactProcessor<CRUDImplementation> {
+ private static final QName IMPLEMENTATION_CRUD = new QName("http://crud", "implementation.crud");
+
+ private CRUDImplementationFactory crudFactory;
+
+ public CRUDImplementationProcessor(CRUDImplementationFactory crudFactory) {
+ this.crudFactory = crudFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_CRUD;
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return CRUDImplementation.class;
+ }
+
+ public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPLEMENTATION_CRUD.equals(reader.getName());
+
+ // Read an <implementation.crud> element
+ try {
+ // Read the directory attribute. This is where the sample
+ // CRUD implementation will persist resources.
+ String directory = reader.getAttributeValue(null, "directory");
+
+ // Create an initialize the CRUD implementation model
+ CRUDImplementation implementation = crudFactory.createCRUDImplementation();
+ implementation.setDirectory(directory);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(CRUDImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(CRUDImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.java
new file mode 100644
index 0000000000..1a5e2ca8a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/module/CRUDModuleActivator.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 crud.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+import crud.CRUDImplementationFactory;
+import crud.DefaultCRUDImplementationFactory;
+import crud.impl.CRUDImplementationProcessor;
+import crud.provider.CRUDImplementationProviderFactory;
+
+/**
+ * Implements a module activator for the CRUD implementation extension module.
+ * The module activator is responsible for contributing the CRUD implementation
+ * extensions and plugging them in the extension points defined by the Tuscany
+ * runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CRUDModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // This module extension does not contribute any new
+ // extension point
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the CRUD implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory, introspector);
+
+ // Add the CRUD implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ CRUDImplementationProcessor implementationArtifactProcessor = new CRUDImplementationProcessor(crudFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the CRUD provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new CRUDImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProvider.java
new file mode 100644
index 0000000000..f81165f564
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProvider.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 crud.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import crud.CRUDImplementation;
+import crud.backend.ResourceManager;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class CRUDImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private CRUDImplementation implementation;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProviderFactory.java
new file mode 100644
index 0000000000..9eb5fdeb61
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDImplementationProviderFactory.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 crud.provider;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ return new CRUDImplementationProvider(component, implementation);
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ return CRUDImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDInvoker.java
new file mode 100644
index 0000000000..2299ce8b0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/crud/provider/CRUDInvoker.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 crud.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+import crud.backend.ResourceManager;
+
+/**
+ * Implements a target invoker for CRUD component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ *
+ * @version $Rev$ $Date$
+ */
+public class CRUDInvoker implements Invoker {
+ private Operation operation;
+ private ResourceManager resourceManager;
+
+ public CRUDInvoker(Operation operation, ResourceManager resourceManager) {
+ this.operation = operation;
+ this.resourceManager = resourceManager;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ if (operation.getName().equals("create")) {
+ return resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ return resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ return resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ return null;
+
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
new file mode 100644
index 0000000000..817a151374
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.osoa.sca.ServiceReference;
+
+import crud.CRUD;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCADomainBeanTestCase extends TestCase {
+
+ private SCADomainBean domain;
+
+ protected void setUp() throws Exception {
+ domain = new SCADomainBean();
+ domain.setDeployableComposites("crud.composite");
+ }
+
+ public void testStart() throws Exception {
+ ServiceReference<CRUD> serviceReference = domain.getServiceReference(CRUD.class, "CRUDServiceComponent");
+ assertNotNull(serviceReference);
+ CRUD service = serviceReference.getService();
+ String id = service.create("ABC");
+ Object result = service.retrieve(id);
+ assertEquals("ABC", result);
+ service.update(id, "EFG");
+ result = service.retrieve(id);
+ assertEquals("EFG", result);
+ service.delete(id);
+ result = service.retrieve(id);
+ assertNull(result);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
new file mode 100644
index 0000000000..297858ea9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.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.host.embedded;
+
+import junit.framework.TestCase;
+
+import org.osoa.sca.ServiceReference;
+
+import crud.CRUD;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SCADomainTestCase extends TestCase {
+
+ private SCADomain domain;
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("crud.composite");
+ }
+
+ public void testStart() throws Exception {
+ ServiceReference<CRUD> serviceReference = domain.getServiceReference(CRUD.class, "CRUDServiceComponent");
+ assertNotNull(serviceReference);
+ CRUD service = serviceReference.getService();
+ String id = service.create("ABC");
+ Object result = service.retrieve(id);
+ assertEquals("ABC", result);
+ service.update(id, "EFG");
+ result = service.retrieve(id);
+ assertEquals("EFG", result);
+ service.delete(id);
+ result = service.retrieve(id);
+ assertNull(result);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
new file mode 100644
index 0000000000..9ad6fd3920
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.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.host.embedded.impl;
+
+import junit.framework.TestCase;
+import crud.CRUD;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultSCADomainTestCase extends TestCase {
+ private DefaultSCADomain domain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ domain = new DefaultSCADomain(getClass().getClassLoader(), getClass().getClassLoader(),
+ "http://localhost", ".", "crud.composite");
+ }
+
+ public void testStart() throws Exception {
+ CRUD service = domain.getService(CRUD.class, "CRUDServiceComponent");
+ assertNotNull(service);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
new file mode 100644
index 0000000000..dfc1d718b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.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.host.embedded.impl;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+
+import crud.CRUD;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EmbeddedSCADomainTestCase extends TestCase {
+ private EmbeddedSCADomain domain;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+
+ // Create a test embedded SCA domain
+ domain = new EmbeddedSCADomain(getClass().getClassLoader(), "http://localhost");
+ }
+
+ public void testDomain() throws Exception {
+
+ // Start the domain
+ domain.start();
+
+ // Determine my class loader and my test SCA contribution location
+ ClassLoader myClassLoader = getClass().getClassLoader();
+ String url = myClassLoader.getResource("test.txt").toString();
+ url = url.substring(0, url.length()-8);
+
+ // Contribute the SCA contribution
+ TestModelResolver myResolver = new TestModelResolver(myClassLoader);
+ ContributionService contributionService = domain.getContributionService();
+ Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
+ assertNotNull(contribution);
+
+ // Decide which SCA composite I want to deploy
+ Composite myComposite = myResolver.getComposite(new QName("http://sample/crud", "crud"));
+
+ // Add the deployable composite to the domain
+ EmbeddedSCADomain.DomainCompositeHelper domainHelper = domain.getDomainCompositeHelper();
+ domainHelper.addComposite(myComposite);
+
+ // Start the components in my composite
+ domainHelper.startComposite(myComposite);
+
+ // At this point the domain contains my contribution, my composite and
+ // it's started, my application code can start using it
+
+ // Get the CRUDServiceComponent service
+ CRUD service = domain.getService(CRUD.class, "CRUDServiceComponent");
+
+ // Invoke the service
+ String id = service.create("ABC");
+ Object result = service.retrieve(id);
+ assertEquals("ABC", result);
+ service.update(id, "EFG");
+ result = service.retrieve(id);
+ assertEquals("EFG", result);
+ service.delete(id);
+ result = service.retrieve(id);
+ assertNull(result);
+
+ // Stop my composite
+ domainHelper.stopComposite(myComposite);
+
+ // Remove my composite
+ domainHelper.removeComposite(myComposite);
+
+ // Remove my contribution
+ contributionService.remove("http://test/contribution");
+
+ // Stop the domain
+ domain.stop();
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
new file mode 100644
index 0000000000..6969cba054
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.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.sca.host.embedded.impl;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A test model 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>();
+ private WeakReference<ClassLoader> classLoader;
+
+ private Map<QName, Composite> composites = new HashMap<QName, Composite>();
+
+ public TestModelResolver(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ 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 if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ return modelClass.cast(resolved);
+
+ } else {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+ }
+
+ public void addModel(Object resolved) {
+ map.put(resolved, resolved);
+ if (resolved instanceof Composite) {
+ Composite composite = (Composite)resolved;
+ composites.put(composite.getName(), composite);
+ }
+ }
+
+ public Object removeModel(Object resolved) {
+ if (resolved instanceof Composite) {
+ Composite composite = (Composite)resolved;
+ composites.remove(composite.getName());
+ }
+ return map.remove(resolved);
+ }
+
+ public Composite getComposite(QName qname) {
+ return composites.get(qname);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..266d53ffc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+crud.module.CRUDModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/crud.composite b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/crud.composite
new file mode 100644
index 0000000000..65f24ec93c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/crud.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"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/test.txt b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/test.txt
new file mode 100644
index 0000000000..287f9b1f65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-embedded/src/test/resources/test.txt
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License. \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/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/sca-java-1.x/branches/sca-java-0.90/modules/host-http/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/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/sca-java-1.x/branches/sca-java-0.90/modules/host-http/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/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/sca-java-1.x/branches/sca-java-0.90/modules/host-http/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/pom.xml
new file mode 100644
index 0000000000..8c7a971f2f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/pom.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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-http</artifactId>
+ <name>Apache Tuscany HTTP Servlet Host Extension Point</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/DefaultServletHostExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/DefaultServletHostExtensionPoint.java
new file mode 100644
index 0000000000..b3132438eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/DefaultServletHostExtensionPoint.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.http;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of a servlet host extension point.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultServletHostExtensionPoint implements ServletHostExtensionPoint {
+
+ private List<ServletHost> servletHosts = new ArrayList<ServletHost>();
+
+ public void addServletHost(ServletHost servletHost) {
+ servletHosts.add(servletHost);
+ }
+
+ public void removeServletHost(ServletHost servletHost) {
+ servletHosts.remove(servletHost);
+ }
+
+ public List<ServletHost> getServletHosts() {
+ return servletHosts;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ExtensibleServletHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ExtensibleServletHost.java
new file mode 100644
index 0000000000..af28b6241c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ExtensibleServletHost.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.sca.http;
+
+import javax.servlet.Servlet;
+
+/**
+ * Default implementation of an extensible servlet host.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleServletHost implements ServletHost {
+
+ private ServletHostExtensionPoint servletHosts;
+
+ public ExtensibleServletHost(ServletHostExtensionPoint servletHosts) {
+ this.servletHosts = servletHosts;
+ }
+
+ public void addServletMapping(String uri, Servlet servlet) throws ServletMappingException {
+ if (servletHosts.getServletHosts().isEmpty()) {
+ throw new ServletMappingException("No servlet host available");
+ }
+
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ servletHosts.getServletHosts().get(0).addServletMapping(uri, servlet);
+ }
+
+ public Servlet removeServletMapping(String uri) throws ServletMappingException {
+ // TODO implement selection of the correct servlet host based on the mapping
+ // For now just select the first one
+ return servletHosts.getServletHosts().get(0).removeServletMapping(uri);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHost.java
new file mode 100644
index 0000000000..eeab5d02eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHost.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.sca.http;
+
+import javax.servlet.Servlet;
+
+/**
+ * Interface implemented by host environments that allow Servlets to be
+ * registered.
+ * <p/>
+ * This interface allows a system service to register a servlet
+ * to handle inbound requests.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHost {
+ /**
+ * Add a mapping for an instance of a Servlet. This requests that the
+ * servlet container direct all requests to the designated mapping to the
+ * supplied Servlet instance.
+ *
+ * @param uri the uri-mapping for the Servlet
+ * @param servlet the Servlet that should be invoked
+ */
+ void addServletMapping(String uri, Servlet servlet) throws ServletMappingException;
+
+ /**
+ * Remove a servlet mapping. This directs the servlet contain not to direct
+ * any more requests to a previously registered Servlet.
+ *
+ * @param uri the uri-mapping for the Servlet
+ * @return the servlet that was registered to the mapping, null if nothing
+ * was registered to the mapping
+ */
+ Servlet removeServletMapping(String uri) throws ServletMappingException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHostExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHostExtensionPoint.java
new file mode 100644
index 0000000000..8c13844a5f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletHostExtensionPoint.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.http;
+
+import java.util.List;
+
+/**
+ * An extension point for servlet hosts.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ServletHostExtensionPoint {
+
+ /**
+ * Adds a servlet host extension.
+ *
+ * @param servletHost
+ */
+ void addServletHost(ServletHost servletHost);
+
+ /**
+ * Removes a servlet host extension.
+ *
+ * @param servletHost
+ */
+ void removeServletHost(ServletHost servletHost);
+
+ /**
+ * Returns a list of servlet host extensions.
+ *
+ * @return
+ */
+ List<ServletHost> getServletHosts();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletMappingException.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletMappingException.java
new file mode 100644
index 0000000000..2247d5f66c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/ServletMappingException.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.sca.http;
+
+/**
+ * Indicates an exception while registering a servlet mapping.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServletMappingException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ public ServletMappingException() {
+ super();
+ }
+
+ public ServletMappingException(String message) {
+ super(message);
+ }
+
+ public ServletMappingException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ServletMappingException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/module/HTTPRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/module/HTTPRuntimeModuleActivator.java
new file mode 100644
index 0000000000..f5e6896b05
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/java/org/apache/tuscany/sca/http/module/HTTPRuntimeModuleActivator.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.http.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.DefaultServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.ExtensibleServletHost;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HTTPRuntimeModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // Declare Servlet host extension point
+ ServletHostExtensionPoint hostExtensions = new DefaultServletHostExtensionPoint();
+ ExtensibleServletHost host = new ExtensibleServletHost(hostExtensions);
+ return new Object[] { hostExtensions, host };
+ }
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..7aa9e94f0a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.module.HTTPRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/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/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/pom.xml
new file mode 100644
index 0000000000..fe8d05ae99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-host-rmi</artifactId>
+ <name>Apache Tuscany Java RMI Host Extension Point</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/DefaultRMIHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/DefaultRMIHost.java
new file mode 100644
index 0000000000..82c2a01e6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/DefaultRMIHost.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.sca.rmi;
+
+import java.rmi.AlreadyBoundException;
+import java.rmi.NotBoundException;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Default implementation of a rmi host extension point.
+ *
+ */
+public class DefaultRMIHost implements RMIHost {
+
+ //map of RMI registries started and running
+ private Map<String, Registry> rmiRegistries;
+
+ public DefaultRMIHost() {
+ rmiRegistries = new ConcurrentHashMap<String, Registry>();
+ /*
+ * if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }
+ */
+ }
+
+ public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException {
+ Registry registry;
+ try {
+ registry = rmiRegistries.get(Integer.toString(port));
+ if (registry == null) {
+ registry = LocateRegistry.createRegistry(port);
+ rmiRegistries.put(Integer.toString(port),
+ registry);
+ }
+ registry.bind(serviceName,
+ serviceObject);
+ } catch (AlreadyBoundException e) {
+ throw new RMIHostException(e);
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ }
+
+ }
+
+ public void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException {
+ registerService(serviceName,
+ RMI_DEFAULT_PORT,
+ serviceObject);
+ }
+
+ public void unregisterService(String serviceName, int port) throws RMIHostException,
+ RMIHostRuntimeException {
+ Registry registry;
+
+ try {
+ registry = rmiRegistries.get(Integer.toString(port));
+ if (registry == null) {
+ registry = LocateRegistry.createRegistry(port);
+ rmiRegistries.put(Integer.toString(port),
+ registry);
+ }
+ registry.unbind(serviceName);
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ } catch (NotBoundException e) {
+ throw new RMIHostException(e.getMessage());
+ }
+ }
+
+ public void unregisterService(String serviceName) throws RMIHostException,
+ RMIHostRuntimeException {
+ unregisterService(serviceName,
+ RMI_DEFAULT_PORT);
+
+ }
+
+ public Remote findService(String host, String port, String svcName) throws RMIHostException,
+ RMIHostRuntimeException {
+ Registry registry;
+ Remote remoteService = null;
+ host = (host == null || host.length() <= 0) ? "localhost" : host;
+ int portNumber = (port == null || port.length() <= 0) ? RMI_DEFAULT_PORT : Integer
+ .decode(port);
+
+ try {
+ registry = LocateRegistry.getRegistry(host,
+ portNumber);
+
+ if (registry != null) {
+ remoteService = registry.lookup(svcName);
+ }
+ } catch (RemoteException e) {
+ RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
+ rmiExec.setStackTrace(e.getStackTrace());
+ throw rmiExec;
+ } catch (NotBoundException e) {
+ throw new RMIHostException(e.getMessage());
+ }
+ return remoteService;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHost.java
new file mode 100644
index 0000000000..751db8ccff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHost.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.rmi;
+
+import java.rmi.Remote;
+
+/**
+ * RMI Service hosting interface to be implemented by host environments that allows SCA Components
+ * to register RMI Services to handle inbound service requests over RMI to SCA Components
+ */
+public interface RMIHost {
+ int RMI_DEFAULT_PORT = 1099;
+
+ /**
+ * Register an RMI service with the given name and port
+ *
+ * @param serviceName against which the server is to be registered
+ * @param port the port against which the server is to be registered
+ * @param serviceObject the server object to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Register an RMI service with the given name and default port (1099)
+ *
+ * @param serviceName serviceName against which the server is to be registered
+ * @param serviceObject the server object to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Unregister a service registered under the given service name and port number
+ *
+ * @param serviceName serviceName against which the server is to be registered
+ * @param port the port against which the server is to be registered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void unregisterService(String serviceName, int port) throws RMIHostException,
+ RMIHostRuntimeException;
+
+ /**
+ * Unregister a service registered under the given service name and defalut port number (1099)
+ *
+ * @param serviceName the name of the service that has to be unregistered
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ void unregisterService(String serviceName) throws RMIHostException,
+ RMIHostRuntimeException;
+
+
+ /**
+ * find a remote service hosted on the given host, port and service name
+ *
+ * @param host the name of the host on which the rmi service to be unregistered is running
+ * @param port the port against which the server is to be unregistered is running
+ * @param svcName serviceName against which the server is to be unregistered is running
+ * @return the RMI server object
+ * @throws RMIHostException
+ * @throws RMIHostRuntimeException
+ */
+ Remote findService(String host, String port, String svcName) throws RMIHostException,
+ RMIHostRuntimeException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostException.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostException.java
new file mode 100644
index 0000000000..c8ec11ef4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostException.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.rmi;
+
+
+/**
+ * This exception will relate to situations where the end applicaition's input is the cause of the exception
+ *
+ * @version $Rev: 486986 $ $Date: 2006-12-14 11:48:28 +0530 (Thu, 14 Dec 2006) $
+ */
+public class RMIHostException extends RuntimeException {
+
+ private static final long serialVersionUID = 3378300080918544410L;
+
+ public RMIHostException() {
+ }
+
+ public RMIHostException(String message) {
+ super(message);
+ }
+
+ public RMIHostException(Throwable e) {
+ super(e);
+ }
+
+ public RMIHostException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostRuntimeException.java
new file mode 100644
index 0000000000..1b7e9cc4be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/RMIHostRuntimeException.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.rmi;
+
+
+/**
+ * This exception relates to cases where there is a problem with the
+ * Host runtime
+ *
+ */
+public class RMIHostRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -2639598547028423686L;
+
+ public RMIHostRuntimeException() {
+ }
+
+ public RMIHostRuntimeException(String message) {
+ super(message);
+ }
+
+ public RMIHostRuntimeException(Throwable e) {
+ super(e);
+ }
+
+ public RMIHostRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/module/RMIRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/module/RMIRuntimeModuleActivator.java
new file mode 100644
index 0000000000..15e3a6c628
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/java/org/apache/tuscany/sca/rmi/module/RMIRuntimeModuleActivator.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.rmi.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.rmi.DefaultRMIHost;
+import org.apache.tuscany.sca.rmi.RMIHost;
+
+/**
+ * @version $Rev: 529327 $ $Date: 2007-04-16 22:40:43 +0530 (Mon, 16 Apr 2007) $
+ */
+public class RMIRuntimeModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ RMIHost host = new DefaultRMIHost();
+ return new Object[]{ host };
+ }
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..adef00d555
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.rmi.module.RMIRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/test/java/org/apache/tuscany/sca/rmi/RMIHostImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/test/java/org/apache/tuscany/sca/rmi/RMIHostImplTestCase.java
new file mode 100644
index 0000000000..9bce64ecfc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-rmi/src/test/java/org/apache/tuscany/sca/rmi/RMIHostImplTestCase.java
@@ -0,0 +1,73 @@
+/**
+ *
+ * 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.sca.rmi;
+
+import java.rmi.Remote;
+
+import junit.framework.TestCase;
+
+public class RMIHostImplTestCase extends TestCase {
+
+ public void testInit() {
+ new DefaultRMIHost();
+ }
+
+ public void testFindServiceBadHost() throws RMIHostRuntimeException, RMIHostException {
+ try {
+ new DefaultRMIHost().findService(null, "0", null);
+ fail();
+ } catch (RMIHostRuntimeException e) {
+ // expected
+ }
+ }
+
+ public void testRegisterService1() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("foo1", new MockRemote());
+ host.unregisterService("foo1");
+ }
+
+ public void testRegisterService2() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("bar1", 9999, new MockRemote());
+ host.unregisterService("bar1", 9999);
+ }
+
+ public void testRegisterServiceAlreadyBound() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ host.registerService("bar2", 9997, new MockRemote());
+ try {
+ host.registerService("bar2", 9997, new MockRemote());
+ } catch (RMIHostException e) {
+ // expected
+ host.unregisterService("bar2", 9997);
+ }
+ }
+
+ public void testUnRegisterService() throws RMIHostRuntimeException, RMIHostException {
+ DefaultRMIHost host = new DefaultRMIHost();
+ try {
+ host.unregisterService("bar3", 9998);
+ fail();
+ } catch (RMIHostException e) {
+ // expected
+ }
+ }
+
+ private static class MockRemote implements Remote {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/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/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/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/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/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/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/pom.xml
new file mode 100644
index 0000000000..03df94925c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-host-webapp</artifactId>
+ <name>Apache Tuscany webapp host</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version> <!-- to keep compatible with older servlet containers -->
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.java
new file mode 100644
index 0000000000..61a7b54a0c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/SCADomainHelper.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.webapp;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Utility class to initialize the SCADomian associated with a webapp
+ */
+public class SCADomainHelper {
+
+ public static final String SCA_DOMAIN_ATTRIBUTE = "org.apache.tuscany.sca.SCADomain";
+
+ /**
+ * Initializes the SCADomian associated with a webapp context. If a SCADomain
+ * doesn't exist already then one is create based on the webapp config.
+ */
+ public static SCADomain initSCADomain(ServletContext servletContext) {
+ SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
+
+ String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
+ String contributionRoot = null;
+
+ try {
+ URL rootURL = servletContext.getResource("/");
+ if (rootURL.getProtocol().equals("jndi")) {
+ //this is tomcat case, we should use getRealPath
+ File warRootFile = new File(servletContext.getRealPath("/"));
+ contributionRoot = warRootFile.toURL().toString();
+ } else {
+ //this is jetty case
+ contributionRoot = rootURL.toString();
+ }
+ } catch(MalformedURLException mf) {
+ //ignore, pass null
+ }
+
+
+ if (scaDomain == null) {
+ scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
+ servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
+ }
+ return scaDomain;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyContextListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyContextListener.java
new file mode 100644
index 0000000000..e88ace8d32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyContextListener.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.webapp;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A ServletContextListener to create and close the SCADomain
+ * when the webapp is initialized or destroyed.
+ */
+public class TuscanyContextListener implements ServletContextListener {
+
+ public void contextInitialized(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+ try {
+ SCADomainHelper.initSCADomain(servletContext);
+ } catch (Throwable e) {
+ servletContext.log("exception initializing SCADomain", e);
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+ SCADomain scaDomain = (SCADomain) servletContext.getAttribute(SCADomainHelper.SCA_DOMAIN_ATTRIBUTE);
+ if (scaDomain != null) {
+ scaDomain.close();
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.java
new file mode 100644
index 0000000000..ae2cb59e35
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/TuscanyServlet.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.webapp;
+
+import java.io.IOException;
+
+import javax.servlet.Servlet;
+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 javax.servlet.http.HttpServletRequest;
+
+/**
+ * A servlet that forwards requests to the servlets registered with the Tuscany
+ * ServletHost.
+ */
+public class TuscanyServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ protected transient WebAppServletHost servletHost;
+
+ @Override
+ public void init(ServletConfig config) throws ServletException {
+ ServletContext servletContext = config.getServletContext();
+ SCADomainHelper.initSCADomain(servletContext);
+
+ // TODO: must be a better way to get this than using a static
+ servletHost = WebAppServletHost.getInstance();
+ servletHost.init(config);
+ }
+
+ @Override
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
+ String path = ((HttpServletRequest)req).getPathInfo();
+ Servlet servlet = servletHost.getServlet(path);
+ if (servlet == null) {
+ throw new IllegalStateException("No servlet registered for path: " + path);
+ }
+
+ servlet.service(req, res);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppModuleActivator.java
new file mode 100644
index 0000000000..2dee6f3ae2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppModuleActivator.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.webapp;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+
+/**
+ * Activates the webapp host by registering the webapp ServletHost impl
+ */
+public class WebAppModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+
+ servletHosts.addServletHost(WebAppServletHost.getInstance());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.java
new file mode 100644
index 0000000000..29c54b3153
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/java/org/apache/tuscany/sca/webapp/WebAppServletHost.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.webapp;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletMappingException;
+
+/**
+ * ServletHost impl singleton thats shared between the SCADomain
+ * instance and the TuscanyServlet instance.
+ * TODO: using a static singleton seems a big hack but how
+ * should it be shared? Need some way for TuscanyServlet
+ * to pull it out of the SCADomain instance.
+ *
+ */
+public class WebAppServletHost implements ServletHost {
+
+ private static WebAppServletHost instance = new WebAppServletHost();
+
+ private Map<String, Servlet> servlets;
+
+ private WebAppServletHost() {
+ servlets = new HashMap<String, Servlet>();
+ }
+
+ public void addServletMapping(String path, Servlet servlet) throws ServletMappingException {
+ URI pathURI = URI.create(path);
+ // for webapps just use the path and ignore the host and port
+ servlets.put(pathURI.getPath(), servlet);
+ }
+
+ public Servlet removeServletMapping(String path) throws ServletMappingException {
+ URI pathURI = URI.create(path);
+ // for webapps just use the path and ignore the host and port
+ return servlets.remove(pathURI.getPath());
+ }
+
+ public Servlet getServlet(String path) {
+ Servlet servlet = servlets.get(path);
+ if (servlet != null) {
+ return servlet;
+ }
+ for (String servletPath : servlets.keySet()) {
+ if (servletPath.endsWith("*")) {
+ if (path.startsWith(servletPath.substring(0, servletPath.length()-1))) {
+ return servlets.get(servletPath);
+ }
+ }
+ }
+ return null;
+ }
+
+ public static WebAppServletHost getInstance() {
+ return instance;
+ }
+
+ public void init(ServletConfig config) throws ServletException {
+ for (Servlet servlet : servlets.values()) {
+ servlet.init(config);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..ad19f0464d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.webapp.WebAppModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/.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/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/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/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/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/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/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/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/pom.xml
new file mode 100644
index 0000000000..dfcd621e72
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <name>Apache Tuscany Jetty HTTP Service</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>6.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>6.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java
new file mode 100644
index 0000000000..1ecf1bca1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.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.sca.http.jetty;
+
+import org.mortbay.log.Logger;
+
+/**
+ * Replaces Jetty's logging mechanism
+ *
+ * @version $Rev$ $Date$
+ */
+public class JettyLogger implements Logger {
+
+ private boolean debugEnabled;
+
+ public boolean isDebugEnabled() {
+ return debugEnabled;
+ }
+
+ public void setDebugEnabled(boolean debugEnabled) {
+ this.debugEnabled = debugEnabled;
+ }
+
+ public void info(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":INFO: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void debug(String msg, Throwable th) {
+ if (debugEnabled) {
+ System.err.println(":DEBUG: " + msg);
+ th.printStackTrace();
+ }
+ }
+
+ public void debug(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":DEBUG: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void warn(String msg, Object arg0, Object arg1) {
+ if (debugEnabled) {
+ System.err.println(":WARN: " + format(msg, arg0, arg1));
+ }
+ }
+
+ public void warn(String msg, Throwable th) {
+ if (debugEnabled) {
+ System.err.println(":WARN: " + msg);
+ th.printStackTrace();
+ }
+ }
+
+ public Logger getLogger(String name) {
+ return this;
+ }
+
+ private String format(String msg, Object arg0, Object arg1) {
+ int i0 = msg.indexOf("{}");
+ int i1 = i0 < 0 ? -1 : msg.indexOf("{}", i0 + 2);
+ if (arg1 != null && i1 >= 0) {
+ msg = msg.substring(0, i1) + arg1 + msg.substring(i1 + 2);
+ }
+ if (arg0 != null && i0 >= 0) {
+ msg = msg.substring(0, i0) + arg0 + msg.substring(i0 + 2);
+ }
+ return msg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
new file mode 100644
index 0000000000..09f4036ccc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.jetty;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletException;
+
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletMappingException;
+import org.apache.tuscany.sca.work.WorkScheduler;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.ContextHandler;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.security.SslSocketConnector;
+import org.mortbay.jetty.servlet.ServletHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.servlet.ServletMapping;
+import org.mortbay.jetty.servlet.SessionHandler;
+import org.mortbay.log.Log;
+import org.mortbay.log.Logger;
+import org.mortbay.thread.ThreadPool;
+
+/**
+ * Implements an HTTP transport service using Jetty.
+ *
+ * @version $$Rev$$ $$Date: 2007-02-21 13:28:30 +0000 (Wed, 21 Feb
+ * 2007) $$
+ */
+public class JettyServer implements ServletHost {
+
+ private static final String ROOT = "/";
+ private static final int ERROR = 0;
+ private static final int UNINITIALIZED = 0;
+ private static final int STARTING = 1;
+ private static final int STARTED = 2;
+ private static final int STOPPING = 3;
+ private static final int STOPPED = 4;
+ private static final int DEFAULT_PORT = 8080;
+
+ private final Object joinLock = new Object();
+ private int state = UNINITIALIZED;
+ private String keystore;
+ private String certPassword;
+ private String keyPassword;
+ private boolean sendServerVersion;
+ private boolean https;
+ private int httpsPort = 8484;
+ private boolean debug;
+ private Server server;
+ private Connector connector;
+ private ServletHandler servletHandler;
+ private WorkScheduler workScheduler;
+
+ static {
+ // hack to replace the static Jetty logger
+ System.setProperty("org.mortbay.log.class", JettyLogger.class.getName());
+
+ }
+
+ public JettyServer(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+
+ // Configure the Jetty logger
+ Logger logger = Log.getLogger(null);
+ if (logger instanceof JettyLogger) {
+ JettyLogger jettyLogger = (JettyLogger)logger;
+ if (debug) {
+ jettyLogger.setDebugEnabled(true);
+ }
+ }
+ }
+
+ public void setSendServerVersion(boolean sendServerVersion) {
+ this.sendServerVersion = sendServerVersion;
+ }
+
+ public void setHttps(boolean https) {
+ this.https = https;
+ }
+
+ public void setKeystore(String keystore) {
+ this.keystore = keystore;
+ }
+
+ public void setCertPassword(String certPassword) {
+ this.certPassword = certPassword;
+ }
+
+ public void setKeyPassword(String keyPassword) {
+ this.keyPassword = keyPassword;
+ }
+
+ public void setDebug(boolean val) {
+ debug = val;
+ }
+
+ public void init() {
+ state = STARTING;
+ }
+
+ public void destroy() {
+ if (state == STARTED) {
+ state = STOPPING;
+ synchronized (joinLock) {
+ joinLock.notifyAll();
+ }
+ try {
+ server.stop();
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+ state = STOPPED;
+ }
+ }
+
+ public void addServletMapping(String uriStr, Servlet servlet) throws ServletMappingException {
+ URI uri = URI.create(uriStr);
+ if (state == STARTING) {
+
+ int port = uri.getPort();
+ if (port == -1) {
+ port = DEFAULT_PORT;
+ }
+
+ try {
+ server = new Server();
+ server.setThreadPool(new WorkSchedulerThreadPool());
+ if (connector == null) {
+ if (https) {
+ Connector httpConnector = new SelectChannelConnector();
+ httpConnector.setPort(port);
+ SslSocketConnector sslConnector = new SslSocketConnector();
+ sslConnector.setPort(httpsPort);
+ sslConnector.setKeystore(keystore);
+ sslConnector.setPassword(certPassword);
+ sslConnector.setKeyPassword(keyPassword);
+ server.setConnectors(new Connector[] {httpConnector, sslConnector});
+ } else {
+ SelectChannelConnector selectConnector = new SelectChannelConnector();
+ selectConnector.setPort(port);
+ server.setConnectors(new Connector[] {selectConnector});
+ }
+ } else {
+ connector.setPort(port);
+ server.setConnectors(new Connector[] {connector});
+ }
+
+ ContextHandler contextHandler = new ContextHandler();
+ contextHandler.setContextPath(ROOT);
+ server.setHandler(contextHandler);
+
+ SessionHandler sessionHandler = new SessionHandler();
+ servletHandler = new ServletHandler();
+ sessionHandler.addHandler(servletHandler);
+
+ contextHandler.setHandler(sessionHandler);
+
+ server.setStopAtShutdown(true);
+ server.setSendServerVersion(sendServerVersion);
+ // monitor.started();
+ server.start();
+ state = STARTED;
+ } catch (Exception e) {
+ state = ERROR;
+ throw new ServletMappingException(e);
+ }
+ }
+
+ ServletHolder holder = new ServletHolder(servlet);
+ servletHandler.addServlet(holder);
+ ServletMapping mapping = new ServletMapping();
+ mapping.setServletName(holder.getName());
+ String path = uri.getPath();
+ mapping.setPathSpec(path);
+ servletHandler.addServletMapping(mapping);
+ }
+
+ public Servlet removeServletMapping(String uri) {
+ Servlet removedServlet = null;
+ List<ServletMapping> mappings =
+ new ArrayList<ServletMapping>(Arrays.asList(servletHandler.getServletMappings()));
+ String path = URI.create(uri).getPath();
+ for (ServletMapping mapping : mappings) {
+ if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
+ try {
+ removedServlet = servletHandler.getServlet(mapping.getServletName()).getServlet();
+ } catch (ServletException e) {
+ throw new IllegalStateException(e);
+ }
+ mappings.remove(mapping);
+ break;
+ }
+ }
+ if (removedServlet != null) {
+ servletHandler.setServletMappings((ServletMapping[])mappings.toArray(new ServletMapping[mappings.size()]));
+ }
+ return removedServlet;
+ }
+
+ /**
+ * An integration wrapper to enable use of a {@link WorkScheduler} with Jetty
+ */
+ private class WorkSchedulerThreadPool implements ThreadPool {
+
+ public boolean dispatch(Runnable work) {
+ workScheduler.scheduleWork(work);
+ return true;
+ }
+
+ public void join() throws InterruptedException {
+ synchronized (joinLock) {
+ joinLock.wait();
+ }
+ }
+
+ public int getThreads() {
+ throw new UnsupportedOperationException();
+ }
+
+ public int getIdleThreads() {
+ throw new UnsupportedOperationException();
+ }
+
+ public boolean isLowOnThreads() {
+ // TODO FIXME
+ return false;
+ }
+
+ public void start() throws Exception {
+ }
+
+ public void stop() throws Exception {
+ }
+
+ public boolean isRunning() {
+ return state == STARTING || state == STARTED;
+ }
+
+ public boolean isStarted() {
+ return state == STARTED;
+ }
+
+ public boolean isStarting() {
+ return state == STARTING;
+ }
+
+ public boolean isStopping() {
+ return state == STOPPING;
+ }
+
+ public boolean isFailed() {
+ return state == ERROR;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java
new file mode 100644
index 0000000000..dfc2c18a53
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.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.http.jetty.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.jetty.JettyServer;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyRuntimeModuleActivator implements ModuleActivator {
+
+ private JettyServer server;
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ // Register a Jetty servlet host
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+ WorkScheduler workScheduler = extensionPointRegistry.getExtensionPoint(WorkScheduler.class);
+ server = new JettyServer(workScheduler);
+ servletHosts.addServletHost(server);
+ server.init();
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ server.destroy();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f61708de90
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.jetty.module.JettyRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
new file mode 100644
index 0000000000..2a9be0a62f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.jetty;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.ConnectException;
+import java.net.Socket;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JettyServerTestCase extends TestCase {
+
+ private static final String REQUEST1_HEADER =
+ "GET / HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST1_CONTENT = "";
+ private static final String REQUEST1 =
+ REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
+
+ private static final int HTTP_PORT = 8080;
+
+ private WorkScheduler workScheduler = new WorkScheduler() {
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ Thread thread = new Thread(work);
+ thread.start();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ scheduleWork(work);
+ }
+ };
+
+ /**
+ * Verifies requests are properly routed according to the servlet mapping
+ */
+ public void testRegisterServletMapping() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ }
+
+ public void testUnregisterMapping() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ String uri = "http://127.0.0.1:" + HTTP_PORT + "/foo";
+ service.addServletMapping(uri, servlet);
+ service.removeServletMapping(uri);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertFalse(servlet.invoked);
+ }
+
+ public void testRequestSession() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.setDebug(true);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ assertNotNull(servlet.sessionId);
+ }
+
+ public void testRestart() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.init();
+ service.destroy();
+ service.init();
+ service.destroy();
+ }
+
+ public void testNoMappings() throws Exception {
+ JettyServer service = new JettyServer(workScheduler);
+ service.init();
+ Exception ex = null;
+ try {
+ new Socket("127.0.0.1", HTTP_PORT);
+ } catch (ConnectException e) {
+ ex = e;
+ }
+ assertNotNull(ex);
+ service.destroy();
+ }
+
+ private static String read(Socket socket) throws IOException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ StringBuffer sb = new StringBuffer();
+ String str;
+ while ((str = reader.readLine()) != null) {
+ sb.append(str);
+ }
+ return sb.toString();
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+ private class TestServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ boolean invoked;
+ String sessionId;
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ invoked = true;
+ sessionId = req.getSession().getId();
+ OutputStream writer = resp.getOutputStream();
+ try {
+ writer.write("result".getBytes());
+ } finally {
+ writer.close();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/.ruleset
new file mode 100644
index 0000000000..3886f07f2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/.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/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/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/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/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/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/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/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/pom.xml
new file mode 100644
index 0000000000..3ab2784bbd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <name>Apache Tuscany Tomcat HTTP Service</name>
+
+ <repositories>
+ <repository>
+ <id>tomcat-m2-repo</id>
+ <name>Tomcat M2 Repository</name>
+ <url>http://tomcat.apache.org/dev/dist/m2-repository/</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-http</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.10</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>coyote</artifactId>
+ <version>6.0.10</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java
new file mode 100644
index 0000000000..a92b2bcd60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.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.http.tomcat;
+
+import javax.servlet.Servlet;
+
+import org.apache.catalina.core.StandardWrapper;
+
+/**
+ * A servlet wrapper.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServletWrapper extends StandardWrapper {
+ private static final long serialVersionUID = 1L;
+
+ private final Servlet servlet;
+
+ public ServletWrapper(Servlet servlet) {
+ this.servlet = servlet;
+ }
+
+ public synchronized Servlet loadServlet() {
+ return servlet;
+ }
+
+ public Servlet getServlet() {
+ return servlet;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
new file mode 100644
index 0000000000..3ead50c8e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.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.sca.http.tomcat;
+
+import java.net.URI;
+import java.util.concurrent.Executor;
+
+import javax.servlet.Servlet;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.Lifecycle;
+import org.apache.catalina.Wrapper;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.core.StandardEngine;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.startup.ContextConfig;
+import org.apache.coyote.http11.Http11Protocol;
+import org.apache.tomcat.util.buf.MessageBytes;
+import org.apache.tomcat.util.http.mapper.MappingData;
+import org.apache.tomcat.util.net.JIoEndpoint;
+import org.apache.tuscany.sca.http.ServletHost;
+import org.apache.tuscany.sca.http.ServletMappingException;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * A Tomcat based implementation of ServletHost.
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("deprecation")
+public class TomcatServer implements ServletHost {
+
+ private static final int DEFAULT_PORT = 8080;
+ private StandardEngine engine;
+ private StandardHost host;
+ private Connector connector;
+ private WorkScheduler workScheduler;
+
+ /**
+ * A custom connector that uses our WorkScheduler to schedule
+ * worker threads.
+ */
+ private class CustomConnector extends Connector {
+
+ private class CustomHttpProtocolHandler extends Http11Protocol {
+
+ /**
+ * An Executor wrappering our WorkScheduler
+ */
+ private class WorkSchedulerExecutor implements Executor {
+ public void execute(Runnable command) {
+ workScheduler.scheduleWork(command);
+ }
+ }
+
+ /**
+ * A custom Endpoint that waits for its acceptor thread to
+ * terminate before stopping.
+ */
+ private class CustomEndpoint extends JIoEndpoint {
+ private Thread acceptorThread;
+
+ private class CustomAcceptor extends Acceptor {
+ CustomAcceptor() {
+ super();
+ }
+ }
+
+ public void start() throws Exception {
+ if (!initialized)
+ init();
+ if (!running) {
+ running = true;
+ paused = false;
+ acceptorThread = new Thread(new CustomAcceptor(), getName() + "-Acceptor-" + 0);
+ acceptorThread.setPriority(threadPriority);
+ acceptorThread.setDaemon(daemon);
+ acceptorThread.start();
+ }
+ }
+
+ public void stop() {
+ super.stop();
+ try {
+ acceptorThread.join();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public int getCurrentThreadsBusy() {
+ return 0;
+ }
+ }
+
+ CustomHttpProtocolHandler() {
+ endpoint = new CustomEndpoint();
+ endpoint.setExecutor(new WorkSchedulerExecutor());
+ }
+ }
+
+ CustomConnector() throws Exception {
+ protocolHandler = new CustomHttpProtocolHandler();
+ }
+ }
+
+ /**
+ * Constructs a new embedded Tomcat server.
+ *
+ * @param workScheduler the WorkScheduler to use to process requests.
+ */
+ public TomcatServer(WorkScheduler workScheduler) {
+ this.workScheduler = workScheduler;
+ }
+
+ public void init() throws ServletMappingException {
+
+ // Create an engine
+ engine = new StandardEngine();
+ engine.setBaseDir("");
+ engine.setDefaultHost("localhost");
+
+ // Create a host
+ host = new StandardHost();
+ host.setAppBase("");
+ host.setName("localhost");
+ engine.addChild(host);
+
+ // Create the root context
+ StandardContext context = new StandardContext();
+ context.setDocBase("");
+ context.setPath("");
+ ContextConfig config = new ContextConfig();
+ ((Lifecycle)context).addLifecycleListener(config);
+ host.addChild(context);
+ }
+
+ public void destroy() throws ServletMappingException {
+
+ // Stop the server
+ try {
+ if (connector !=null) {
+ connector.stop();
+ engine.stop();
+ }
+ } catch (Exception e) {
+ throw new ServletMappingException(e);
+ }
+ }
+
+ public void addServletMapping(String uri, Servlet servlet) {
+
+ // TODO: use the port from the uri, but thats a bit harder to do
+ int port = DEFAULT_PORT;
+
+ // Install a default HTTP connector
+ if (connector == null) {
+ //TODO support multiple connectors on different ports
+ try {
+ engine.start();
+ connector = new CustomConnector();
+ connector.setPort(port);
+ connector.setContainer(engine);
+ connector.initialize();
+ connector.start();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ // Register the servlet mapping
+ String mapping = URI.create(uri).getPath();
+ Context context = host.map(mapping);
+ Wrapper wrapper = new ServletWrapper(servlet);
+ wrapper.setName(mapping);
+ wrapper.addMapping(mapping);
+ context.addChild(wrapper);
+ context.addServletMapping(mapping, mapping);
+ connector.getMapper().addWrapper("localhost", "", mapping, wrapper);
+ }
+
+ public Servlet removeServletMapping(String uri) {
+ String mapping = URI.create(uri).getPath();
+ Context context = host.map(mapping);
+ MappingData md = new MappingData();
+ MessageBytes mb = MessageBytes.newInstance();
+ mb.setString(mapping);
+ try {
+ context.getMapper().map(mb, md);
+ } catch (Exception e) {
+ return null;
+ }
+ if (md.wrapper instanceof ServletWrapper) {
+ ServletWrapper servletWrapper = (ServletWrapper)md.wrapper;
+ context.removeServletMapping(mapping);
+ context.removeChild(servletWrapper);
+ return servletWrapper.getServlet();
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java
new file mode 100644
index 0000000000..3d59813608
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.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.http.tomcat.module;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.http.ServletHostExtensionPoint;
+import org.apache.tuscany.sca.http.tomcat.TomcatServer;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TomcatRuntimeModuleActivator implements ModuleActivator {
+
+ private TomcatServer server;
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry extensionPointRegistry) {
+
+ // Register a Tomcat servlet host
+ ServletHostExtensionPoint servletHosts =
+ extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
+ WorkScheduler workScheduler = extensionPointRegistry.getExtensionPoint(WorkScheduler.class);
+ server = new TomcatServer(workScheduler);
+ server.init();
+ servletHosts.addServletHost(server);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ server.destroy();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..f0f4e17507
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.http.tomcat.module.TomcatRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
new file mode 100644
index 0000000000..915267848d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/http-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.http.tomcat;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.work.NotificationListener;
+import org.apache.tuscany.sca.work.WorkScheduler;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TomcatServerTestCase extends TestCase {
+
+ private static final String REQUEST1_HEADER =
+ "GET /foo HTTP/1.0\n" + "Host: localhost\n"
+ + "Content-Type: text/xml\n"
+ + "Connection: close\n"
+ + "Content-Length: ";
+ private static final String REQUEST1_CONTENT = "";
+ private static final String REQUEST1 =
+ REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
+
+ private static final int HTTP_PORT = 8080;
+
+ private WorkScheduler workScheduler = new WorkScheduler() {
+
+ public <T extends Runnable> void scheduleWork(T work) {
+ Thread thread = new Thread(work);
+ thread.start();
+ }
+
+ public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
+ scheduleWork(work);
+ }
+ };
+
+ /**
+ * Verifies requests are properly routed according to the servlet mapping
+ */
+ public void testRegisterServletMapping() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ }
+
+ public void testUnregisterMapping() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo");
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertFalse(servlet.invoked);
+ }
+
+ public void testRequestSession() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.init();
+ TestServlet servlet = new TestServlet();
+ service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ read(client);
+ service.destroy();
+ assertTrue(servlet.invoked);
+ assertNotNull(servlet.sessionId);
+ }
+
+ public void testRestart() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.init();
+ service.destroy();
+ service.init();
+ service.destroy();
+ }
+
+ public void testNoMappings() throws Exception {
+ TomcatServer service = new TomcatServer(workScheduler);
+ service.init();
+ Exception ex = null;
+ try {
+ Socket client = new Socket("127.0.0.1", HTTP_PORT);
+ OutputStream os = client.getOutputStream();
+ os.write(REQUEST1.getBytes());
+ os.flush();
+ } catch (Exception e) {
+ ex = e;
+ }
+ assertNotNull(ex);
+ service.destroy();
+ }
+
+ private static String read(Socket socket) throws IOException {
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ StringBuffer sb = new StringBuffer();
+ String str;
+ while ((str = reader.readLine()) != null) {
+ sb.append(str);
+ }
+ return sb.toString();
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+
+ private class TestServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+ boolean invoked;
+ String sessionId;
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ invoked = true;
+ sessionId = req.getSession().getId();
+ OutputStream writer = resp.getOutputStream();
+ try {
+ writer.write("result".getBytes());
+ } finally {
+ writer.close();
+ }
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.checkstyle
new file mode 100644
index 0000000000..3e57539570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.pmd
new file mode 100644
index 0000000000..4abfdec2b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/.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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/pom.xml
new file mode 100644
index 0000000000..35401a54ad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <name>Apache Tuscany Java Implementation Runtime</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution-impl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java
new file mode 100644
index 0000000000..a803311a78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.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.implementation.java.context;
+
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+
+/**
+ * Interface for a factory that returns an injected component instance.
+ * This is used by a Component implementation to create new instances of
+ * application implementation objects as determined by the component scope's
+ * lifecycle.
+ * <p/>
+ * The implementation of this interface may be supplied by the user,
+ * may be generated during deployment, or may be dynamic.
+ *
+ * @version $Rev$ $Date$
+ * @param <T> Type of the instance generated by the factory.
+ */
+public interface InstanceFactory<T> {
+ /**
+ * Creates a new instance of the component.
+ * All injected values must be set but any @Init methods must not have been invoked.
+ *
+ * @return A wrapper for the created component instance.
+ */
+ InstanceWrapper<T> newInstance();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java
new file mode 100644
index 0000000000..07f0f93690
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.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.implementation.java.context;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface InstanceFactoryProvider<T> {
+ /**
+ * Return the implementation class.
+ *
+ * @return the implementation class.
+ */
+ Class<T> getImplementationClass();
+
+ /**
+ * Sets an object factory for an injection site
+ *
+ * @param element the injection site name
+ * @param objectFactory the object factory
+ */
+ void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory);
+
+ /**
+ * Create an instance factory that can be used to create component instances.
+ *
+ * @return a new instance factory
+ */
+ InstanceFactory<T> createFactory();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/JavaPropertyValueObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/JavaPropertyValueObjectFactory.java
new file mode 100644
index 0000000000..e6176503f7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/JavaPropertyValueObjectFactory.java
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.context;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+public class JavaPropertyValueObjectFactory {
+ // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
+ protected Mediator mediator = null;
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ boolean isSimpleType;
+
+ public JavaPropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)propertyValue;
+ Element rootElement = doc.getDocumentElement();
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values = getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
+ } else {
+ return new ListObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ } else {
+ List<Node> nodes = getComplexPropertyValues(doc);
+ Object value = null;
+ if (!nodes.isEmpty()) {
+ value = nodes.get(0);
+ }
+ return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if (javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ for (int count = 0; count < rootElement.getChildNodes().getLength(); ++count) {
+ if (rootElement.getChildNodes().item(count).getNodeType() == Document.ELEMENT_NODE) {
+ propValues.add(rootElement.getChildNodes().item(count));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property
+ .getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; // (String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ mediator.getDataBindings().introspectType(targetDataType, null);
+ }
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
+ // return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue, sourceDataType, targetDataType, null));
+ }
+ return instances;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
new file mode 100644
index 0000000000..d763c03545
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.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.sca.implementation.java.context;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.EventInvoker;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceFactory<T> implements InstanceFactory<T> {
+ private final Constructor<T> ctr;
+ private final ObjectFactory<?>[] ctrArgs;
+ private final Injector<T>[] injectors;
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+
+ public ReflectiveInstanceFactory(Constructor<T> ctr,
+ ObjectFactory<?>[] ctrArgs,
+ Injector<T>[] injectors,
+ EventInvoker<T> initInvoker,
+ EventInvoker<T> destroyInvoker) {
+ this.ctr = ctr;
+ this.ctrArgs = ctrArgs;
+ this.injectors = injectors;
+ this.initInvoker = initInvoker;
+ this.destroyInvoker = destroyInvoker;
+ }
+
+ public InstanceWrapper<T> newInstance() {
+ T instance;
+ try {
+ if (ctrArgs != null) {
+ Object[] args = new Object[ctrArgs.length];
+ for (int i = 0; i < args.length; i++) {
+ args[i] = ctrArgs[i].getInstance();
+ }
+ instance = ctr.newInstance(args);
+ } else {
+ instance = ctr.newInstance();
+ }
+ } catch (InstantiationException e) {
+ String name = ctr.getDeclaringClass().getName();
+ throw new AssertionError("Class is not instantiable [" + name + "]");
+ } catch (IllegalAccessException e) {
+ String name = ctr.getName();
+ throw new AssertionError("Constructor is not accessible [" + name + "]");
+ } catch (
+ InvocationTargetException e) {
+ String name = ctr.getName();
+ throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
+ }
+
+ if (injectors != null) {
+ for (Injector<T> injector : injectors) {
+ //FIXME Injectors should never be null
+ if (injector != null)
+ injector.inject(instance);
+ }
+ }
+
+ return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
new file mode 100644
index 0000000000..31547b3e18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.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.implementation.java.context;
+
+import org.apache.tuscany.sca.implementation.java.injection.EventInvoker;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetInitializationException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceWrapper<T> implements InstanceWrapper<T> {
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+ private final T instance;
+
+ public ReflectiveInstanceWrapper(T instance, EventInvoker<T> initInvoker, EventInvoker<T> destroyInvoker) {
+ this.instance = instance;
+ this.initInvoker = initInvoker;
+ this.destroyInvoker = destroyInvoker;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+ public void start() throws TargetInitializationException {
+ if (initInvoker != null) {
+ initInvoker.invokeEvent(instance);
+ }
+ }
+
+
+ public void stop() throws TargetDestructionException {
+ if (destroyInvoker != null) {
+ destroyInvoker.invokeEvent(instance);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/TargetMethodNotFoundException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/TargetMethodNotFoundException.java
new file mode 100644
index 0000000000..d987489114
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/TargetMethodNotFoundException.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.implementation.java.context;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.scope.TargetInvokerCreationException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class TargetMethodNotFoundException extends TargetInvokerCreationException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8565552977647191863L;
+ private Operation operation;
+
+ /**
+ * @param operation
+ */
+ public TargetMethodNotFoundException(Operation operation) {
+ super("Target method not found for operation");
+ this.operation = operation;
+ }
+
+ public Operation getOperation() {
+ return operation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..963e5f6e7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.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.implementation.java.injection;
+
+import java.lang.reflect.Array;
+import java.util.List;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>Array</code>
+ * containing object instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class ArrayMultiplicityObjectFactory implements ObjectFactory<Object> {
+
+ private ObjectFactory[] factories;
+
+ private Class interfaceType;
+
+ public ArrayMultiplicityObjectFactory(Class interfaceType, List<ObjectFactory<?>> factories) {
+ assert interfaceType != null : "Interface type was null";
+ assert factories != null : "Object factories were null";
+ this.interfaceType = interfaceType;
+ this.factories = factories.toArray(new ObjectFactory[factories.size()]);
+ }
+
+ public Object getInstance() throws ObjectCreationException {
+ Object array = Array.newInstance(interfaceType, factories.length);
+ for (int i = 0; i < factories.length; i++) {
+ Array.set(array, i, factories[i].getInstance());
+ }
+ return array;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java
new file mode 100644
index 0000000000..aba8f1a901
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+
+/**
+ * Implementations inject a pre-configured context type (interface) on an instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ContextInjector<S, T> extends Injector<T> {
+
+ void setContext(S context) throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
new file mode 100644
index 0000000000..62958c81de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+public class ConversationIDObjectFactory implements ObjectFactory<String> {
+
+ public ConversationIDObjectFactory() {
+ }
+
+ public String getInstance() {
+ return (String)ThreadMessageContext.getMessageContext().getConversationID();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/EventInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/EventInvoker.java
new file mode 100644
index 0000000000..c2335163d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/EventInvoker.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.implementation.java.injection;
+
+/**
+ * Performs an invocation on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface EventInvoker<T> {
+
+ /**
+ * Performs the invocation on a given instance
+ *
+ * @throws ObjectCallbackException
+ */
+ void invokeEvent(T instance) throws ObjectCallbackException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java
new file mode 100644
index 0000000000..85caad103f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.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.implementation.java.injection;
+
+import java.lang.reflect.Field;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.factory.ObjectFactory} on a given field
+ *
+ * @version $Rev$ $Date$
+ */
+public class FieldInjector<T> implements Injector<T> {
+
+ private final Field field;
+
+ private final ObjectFactory<?> objectFactory;
+
+ /**
+ * Create an injector and have it use the given <code>ObjectFactory</code> to inject a value on the instance using
+ * the reflected <code>Field</code>
+ */
+ public FieldInjector(Field field, ObjectFactory<?> objectFactory) {
+ this.field = field;
+ this.field.setAccessible(true);
+ this.objectFactory = objectFactory;
+ }
+
+ /**
+ * Inject a new value on the given isntance
+ */
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ field.set(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Field is not accessible [" + field + "]");
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java
new file mode 100644
index 0000000000..4a8c8f31b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.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.implementation.java.injection;
+
+
+/**
+ * Root unchecked exception for the injection package
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InjectionRuntimeException extends RuntimeException {
+
+ public InjectionRuntimeException() {
+ super();
+ }
+
+ public InjectionRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InjectionRuntimeException(String message) {
+ super(message);
+ }
+
+ public InjectionRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java
new file mode 100644
index 0000000000..e580f5c2c4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+
+/**
+ * Implementations inject a pre-configured value on an instance
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Injector<T> {
+
+ /**
+ * Inject a value on the given instance
+ */
+ void inject(T instance) throws ObjectCreationException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java
new file mode 100644
index 0000000000..d157a1319f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.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.sca.implementation.java.injection;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class InvalidAccessorException extends InjectionRuntimeException {
+
+ public InvalidAccessorException() {
+ super();
+ }
+
+ public InvalidAccessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidAccessorException(String message) {
+ super(message);
+ }
+
+ public InvalidAccessorException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidResourceTypeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidResourceTypeException.java
new file mode 100644
index 0000000000..382925ed30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidResourceTypeException.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+
+/**
+ * Denotes an invalid resource type, i.e. that is not a component
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourceTypeException extends ObjectCreationException {
+
+ public InvalidResourceTypeException() {
+ super();
+ }
+
+ public InvalidResourceTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidResourceTypeException(String message) {
+ super(message);
+ }
+
+ public InvalidResourceTypeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactory.java
new file mode 100644
index 0000000000..750e9202a4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactory.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.implementation.java.injection;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * An implementation of ObjectFactory that creates instances by looking them up in a JNDI context.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JNDIObjectFactory<T> implements ObjectFactory<T> {
+ private final Context context;
+ private final String name;
+
+ public JNDIObjectFactory(Context context, String name) {
+ this.context = context;
+ this.name = name;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public T getInstance() throws ObjectCreationException {
+ try {
+ return (T) context.lookup(name);
+ } catch (NamingException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
new file mode 100644
index 0000000000..d474d9e781
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.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.implementation.java.injection;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>List</code>
+ * containing object instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class ListMultiplicityObjectFactory implements ObjectFactory<List> {
+
+ private ObjectFactory[] factories;
+
+ public ListMultiplicityObjectFactory(List<ObjectFactory<?>> factories) {
+ assert factories != null : "Object factories were null";
+ this.factories = factories.toArray(new ObjectFactory[factories.size()]);
+ }
+
+ public List getInstance() throws ObjectCreationException {
+ List<Object> list = new ArrayList<Object>();
+ for (ObjectFactory factory : factories) {
+ list.add(factory.getInstance());
+ }
+ return list;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvoker.java
new file mode 100644
index 0000000000..0072d12a60
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvoker.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.implementation.java.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+/**
+ * Performs an wire on a method of a given instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class MethodEventInvoker<T> implements EventInvoker<T> {
+ private final Method method;
+
+ /**
+ * Intantiates an invoker for the given method
+ */
+ public MethodEventInvoker(Method method) {
+ assert method != null;
+ this.method = method;
+ }
+
+ public void invokeEvent(T instance) throws ObjectCallbackException {
+ try {
+ method.invoke(instance, (Object[]) null);
+ } catch (IllegalArgumentException e) {
+ String name = method.getName();
+ throw new ObjectCallbackException("Exception thrown by callback method [" + name + "]", e.getCause());
+ } catch (IllegalAccessException e) {
+ String name = method.getName();
+ throw new AssertionError("Method is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = method.getName();
+ throw new ObjectCallbackException("Exception thrown by callback method [" + name + "]", e.getCause());
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java
new file mode 100644
index 0000000000..1e22a0adce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.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.implementation.java.injection;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Injects a value created by an {@link org.apache.tuscany.sca.factory.ObjectFactory} using a given method
+ *
+ * @version $Rev$ $Date$
+ */
+public class MethodInjector<T> implements Injector<T> {
+ private final Method method;
+ private final ObjectFactory<?> objectFactory;
+
+ public MethodInjector(Method method, ObjectFactory<?> objectFactory) {
+ assert method != null;
+ assert objectFactory != null;
+ this.method = method;
+ this.method.setAccessible(true);
+ this.objectFactory = objectFactory;
+ }
+
+ public void inject(T instance) throws ObjectCreationException {
+ try {
+ method.invoke(instance, objectFactory.getInstance());
+ } catch (IllegalAccessException e) {
+ throw new AssertionError("Method is not accessible [" + method + "]");
+ } catch (IllegalArgumentException e) {
+ throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
+ } catch (InvocationTargetException e) {
+ throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoAccessorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoAccessorException.java
new file mode 100644
index 0000000000..f45faa8b52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoAccessorException.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.implementation.java.injection;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class NoAccessorException extends InjectionRuntimeException {
+ public NoAccessorException() {
+ }
+
+ public NoAccessorException(String message) {
+ super(message);
+ }
+
+ public NoAccessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoAccessorException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoMultiplicityTypeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoMultiplicityTypeException.java
new file mode 100644
index 0000000000..c1d998e811
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/NoMultiplicityTypeException.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.sca.implementation.java.injection;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NoMultiplicityTypeException extends InjectionRuntimeException {
+
+ public NoMultiplicityTypeException() {
+ super();
+ }
+
+ public NoMultiplicityTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public NoMultiplicityTypeException(String message) {
+ super(message);
+ }
+
+ public NoMultiplicityTypeException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ObjectCallbackException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ObjectCallbackException.java
new file mode 100644
index 0000000000..7d9e4e6615
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ObjectCallbackException.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.sca.implementation.java.injection;
+
+/**
+ * Denotes an error when invoking on an object
+ *
+ * @version $Rev$ $Date$
+ */
+public class ObjectCallbackException extends InjectionRuntimeException {
+
+ public ObjectCallbackException() {
+ super();
+ }
+
+ public ObjectCallbackException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ObjectCallbackException(String message) {
+ super(message);
+ }
+
+ public ObjectCallbackException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactory.java
new file mode 100644
index 0000000000..ccf06cf569
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactory.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.implementation.java.injection;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Creates new instances of a Java class
+ *
+ * @version $Rev$ $Date$
+ * @see org.apache.tuscany.sca.implementation.java.injection.Injector
+ */
+public class PojoObjectFactory<T> implements ObjectFactory<T> {
+
+ private final Constructor<T> ctr;
+ private ObjectFactory[] initializerFactories;
+
+ /**
+ * Creates the object factory
+ *
+ * @param ctr the constructor to use when instantiating a new object
+ */
+ public PojoObjectFactory(Constructor<T> ctr) {
+ assert ctr != null;
+ this.ctr = ctr;
+ initializerFactories = new ObjectFactory[ctr.getParameterTypes().length];
+ }
+
+ /**
+ * Creates the object factory
+ *
+ * @param ctr the constructor to use when instantiating a new object
+ * @param factories an ordered list of <code>ObjectFactory</code>s to use for returning constructor parameters
+ */
+ public PojoObjectFactory(Constructor<T> ctr, List<ObjectFactory> factories) {
+ assert ctr != null;
+ int params = ctr.getParameterTypes().length;
+ assert params == factories.size();
+ this.ctr = ctr;
+ initializerFactories = new ObjectFactory[params];
+ int i = 0;
+ for (ObjectFactory factory : factories) {
+ initializerFactories[i] = factory;
+ i++;
+ }
+ }
+
+ /**
+ * Returns the ordered array of <code>ObjectFactory</code>s use in creating constructor parameters
+ */
+ public ObjectFactory[] getInitializerFactories() {
+ return initializerFactories;
+ }
+
+ /**
+ * Sets an <code>ObjectFactory</code>s to use in creating constructor parameter
+ *
+ * @param pos the constructor parameter position
+ * @param factory the object factory
+ */
+ public void setInitializerFactory(int pos, ObjectFactory factory) {
+ assert pos < initializerFactories.length;
+ initializerFactories[pos] = factory;
+ }
+
+ /**
+ * Creates a new instance of an object
+ */
+ public T getInstance() throws ObjectCreationException {
+ int size = initializerFactories.length;
+ Object[] initargs = new Object[size];
+ // create the constructor arg array
+ for (int i = 0; i < size; i++) {
+ ObjectFactory<?> objectFactory = initializerFactories[i];
+ if (objectFactory == null) {
+ // this can happen if a reference is optional
+ initargs[i] = null;
+ } else {
+ initargs[i] = objectFactory.getInstance();
+ }
+ }
+ try {
+ ctr.setAccessible(true);
+ return ctr.newInstance(initargs);
+ } catch (IllegalArgumentException e) {
+ String name = ctr.getName();
+ throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
+ } catch (InstantiationException e) {
+ String name = ctr.getDeclaringClass().getName();
+ throw new AssertionError("Class is not instantiable [" + name + "]");
+ } catch (IllegalAccessException e) {
+ String name = ctr.getName();
+ throw new AssertionError("Constructor is not accessible [" + name + "]");
+ } catch (InvocationTargetException e) {
+ String name = ctr.getName();
+ throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java
new file mode 100644
index 0000000000..49424bb1d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.core.component.RequestContextImpl;
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.osoa.sca.RequestContext;
+
+/**
+ * Creates instances of {@link org.apache.tuscany.sca.core.component.RequestContextImpl} for injection on
+ * component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactory implements ObjectFactory<RequestContext> {
+
+ public RequestContextObjectFactory() {
+ }
+
+ public RequestContext getInstance() throws ObjectCreationException {
+ return new RequestContextImpl();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java
new file mode 100644
index 0000000000..70c368a0e6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.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.implementation.java.injection;
+
+/**
+ * Interface implemented by host environments that allow for resolution of component implementation resources, e.g.
+ * items bound in a JNDI tree.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ResourceHost {
+
+ /**
+ * Resolve a resource matching the given type
+ *
+ * @param type the type of the resources
+ * @throws ResourceResolutionException if an error is encountered during resolution
+ */
+ <T> T resolveResource(Class<T> type) throws ResourceResolutionException;
+
+ /**
+ * Resolve a resource matching the given type and name
+ *
+ * @param type the type of the resources
+ * @param mappedName the mapped name of the resource
+ * @throws ResourceResolutionException if an error is encountered during resolution
+ */
+ <T> T resolveResource(Class<T> type, String mappedName) throws ResourceResolutionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java
new file mode 100644
index 0000000000..c124f278da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+
+/**
+ * Denotes an exception thrown when a runtime resource is not found
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceNotFoundException extends ObjectCreationException {
+
+ public ResourceNotFoundException() {
+ super();
+ }
+
+ public ResourceNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResourceNotFoundException(String message) {
+ super(message);
+ }
+
+ public ResourceNotFoundException(Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
new file mode 100644
index 0000000000..000b1eb533
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.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.sca.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Resolves a runtime resource to be injected on a field or method of a Java component type marked with {@link
+ * org.apache.tuscany.api.annotation.Resource}. If the mapped name of the resource is an absolute URI such as
+ * <code>sca://localhost</code> or <code>jndi://localhost</code> the host container namespace is searched; otherwise the
+ * URI is assumed to be relative and the parent composite is searched. If a mapped name is not provided, i.e. resolution
+ * is by type, the parent composite is first searched followed by the host namespace.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceObjectFactory<T> implements ObjectFactory<T> {
+
+ private Class<T> type;
+ private String mappedName;
+ private ResourceHost host;
+ private boolean optional;
+
+ /**
+ * Instantiates a factory that resolves resources by type
+ *
+ * @param type the type of the resource to inject
+ * @param optional true if an error should be thrown if the resource is not found
+ * @param host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type, boolean optional, ResourceHost host) {
+ this(type, null, optional, host);
+ }
+
+ /**
+ * Instantiates a factory that resolves resources by mapped name
+ *
+ * @param type the type of the resource to inject
+ * @param mappedName the resource name
+ * @param optional true if an error should be thrown if the resource is not found
+ * @param host the runtime resource provider
+ */
+ public ResourceObjectFactory(Class<T> type, String mappedName, boolean optional, ResourceHost host) {
+ this.type = type;
+ this.host = host;
+ this.mappedName = mappedName;
+ this.optional = optional;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public T getInstance() throws ObjectCreationException {
+ try {
+ T resource;
+ if (mappedName == null) {
+ resource = host.resolveResource(type);
+ if (!optional && resource == null) {
+ throw new ResourceNotFoundException("Resource not found: " + type.getName());
+ }
+ } else {
+ resource = host.resolveResource(type, mappedName);
+ if (!optional && resource == null) {
+ throw new ResourceNotFoundException("Resource not found: " + mappedName);
+ }
+ }
+ return resource;
+ } catch (ResourceResolutionException e) {
+ throw new ObjectCreationException(e);
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java
new file mode 100644
index 0000000000..f94b24762a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.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.implementation.java.injection;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceResolutionException extends Exception {
+ private static final long serialVersionUID = 13421352711315479L;
+
+ public ResourceResolutionException() {
+ super();
+ }
+
+ public ResourceResolutionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResourceResolutionException(String message) {
+ super(message);
+ }
+
+ public ResourceResolutionException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java
new file mode 100644
index 0000000000..cc9e59b16d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.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.implementation.java.injection;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * Implementation of ObjectFactory that returns a single instance, typically an immutable type.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactory<T> implements ObjectFactory<T> {
+ private final T instance;
+
+ public SingletonObjectFactory(T instance) {
+ this.instance = instance;
+ }
+
+ public T getInstance() {
+ return instance;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java
new file mode 100644
index 0000000000..eb8bf8d0c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.scope.TargetInvocationException;
+
+/**
+ * Denotes an unknown operation sequence in a conversation
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationSequenceException extends TargetInvocationException {
+
+ public InvalidConversationSequenceException() {
+ super();
+ }
+
+ public InvalidConversationSequenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidConversationSequenceException(String message) {
+ super(message);
+ }
+
+ public InvalidConversationSequenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentInfo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentInfo.java
new file mode 100644
index 0000000000..c544f90af7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentInfo.java
@@ -0,0 +1,414 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.invocation;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.ComponentProperty;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.core.component.ComponentContextImpl;
+import org.apache.tuscany.sca.core.component.ComponentContextProvider;
+import org.apache.tuscany.sca.core.component.ServiceReferenceImpl;
+import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.WireObjectFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.context.TargetMethodNotFoundException;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
+import org.apache.tuscany.sca.implementation.java.injection.ObjectCallbackException;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.PersistenceException;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetInvokerCreationException;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.annotations.ConversationID;
+
+/**
+ * The runtime instantiation of Java component implementations
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaComponentInfo implements ComponentContextProvider {
+ private JavaPropertyValueObjectFactory propertyValueFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+
+ protected RuntimeComponent component;
+ protected PojoConfiguration<?> configuration;
+ protected Scope scope;
+ protected ProxyFactory proxyService;
+ protected URI groupId;
+
+ private final ComponentContext componentContext;
+
+ public JavaComponentInfo(RuntimeComponent component, PojoConfiguration configuration,
+ DataBindingExtensionPoint dataBindingExtensionPoint,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ super();
+ this.configuration = configuration;
+ componentContext = new ComponentContextImpl(this);
+ this.groupId = configuration.getGroupId();
+ this.component = component;
+ this.proxyService = configuration.getProxyFactory();
+ this.dataBindingRegistry = dataBindingExtensionPoint;
+ this.propertyValueFactory = propertyValueObjectFactory;
+ }
+
+ public void destroy(Object instance) throws TargetDestructionException {
+ if (configuration.getDestroyInvoker() != null) {
+ try {
+ configuration.getDestroyInvoker().invokeEvent(instance);
+ } catch (ObjectCallbackException e) {
+ throw new TargetDestructionException("Error destroying component instance : " + getUri().toString(), e);
+ }
+ }
+ }
+
+ public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
+ return configuration.createFactory().newInstance();
+ }
+
+ public void configureProperties(List<ComponentProperty> definedProperties) {
+ for (ComponentProperty p : definedProperties) {
+ configureProperty(p);
+ }
+ }
+
+ public void configureProperty(ComponentProperty configuredProperty) {
+ JavaElementImpl element = configuration.getDefinition().getPropertyMembers().get(configuredProperty.getName());
+
+ if (element != null && !(element.getAnchor() instanceof Constructor) && configuredProperty.getValue() != null) {
+ configuration.getInjectionSites().add(element);
+
+ Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ ObjectFactory<?> propertyObjectFactory = createPropertyValueFactory(configuredProperty, configuredProperty
+ .getValue(), propertyJavaType);
+ configuration.setObjectFactory(element, propertyObjectFactory);
+ }
+ }
+
+ public void start() {
+ if (!configuration.getDefinition().getCallbackMembers().isEmpty()) {
+ Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
+ for (ComponentService service : component.getServices()) {
+
+ RuntimeComponentService componentService = (RuntimeComponentService)service;
+ if (!componentService.getCallbackWires().isEmpty()) {
+ callbackWires.put(componentService.getCallbackWires().get(0).getTarget().getInterfaceContract()
+ .getCallbackInterface().toString(), componentService.getCallbackWires());
+ }
+ }
+
+ for (Map.Entry<String, JavaElementImpl> entry : configuration.getDefinition().getCallbackMembers()
+ .entrySet()) {
+ List<RuntimeWire> wires = callbackWires.get(entry.getKey());
+ if (wires == null) {
+ // this can happen when there are no client wires to a
+ // component that has a callback
+ continue;
+ }
+ JavaElementImpl element = entry.getValue();
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(element.getType(), proxyService, wires);
+ if (!(element.getAnchor() instanceof Constructor)) {
+ configuration.getInjectionSites().add(element);
+ }
+ configuration.setObjectFactory(element, factory);
+ }
+ }
+ for (Reference ref : configuration.getDefinition().getReferences()) {
+ JavaElementImpl element = configuration.getDefinition().getReferenceMembers().get(ref.getName());
+ if (element != null) {
+ if (!(element.getAnchor() instanceof Constructor)) {
+ configuration.getInjectionSites().add(element);
+ }
+ List<RuntimeWire> wireList = null;
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().equals(ref.getName())) {
+ wireList = ((RuntimeComponentReference)reference).getRuntimeWires();
+ break;
+ }
+ }
+ if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
+ List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
+ for (int i = 0; i < wireList.size(); i++) {
+ ObjectFactory<?> factory = createWireFactory(element.getType(), wireList.get(i));
+ factories.add(factory);
+ }
+ configuration.setObjectFactories(element, factories);
+ } else {
+ if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
+ throw new IllegalStateException("Required reference is missing: " + ref.getName());
+ }
+ if (wireList != null && !wireList.isEmpty()) {
+ ObjectFactory<?> factory = createWireFactory(element.getType(), wireList.get(0));
+ configuration.setObjectFactory(element, factory);
+ }
+ }
+ }
+ }
+ }
+
+ public void addPropertyFactory(String name, ObjectFactory<?> factory) {
+ JavaElementImpl element = configuration.getDefinition().getPropertyMembers().get(name);
+
+ if (element != null && !(element.getAnchor() instanceof Constructor)) {
+ configuration.getInjectionSites().add(element);
+ }
+
+ configuration.setObjectFactory(element, factory);
+ }
+
+ public void addResourceFactory(String name, ObjectFactory<?> factory) {
+ JavaResourceImpl resource = configuration.getDefinition()
+ .getResources().get(name);
+
+ if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
+ configuration.getInjectionSites().add(resource.getElement());
+ }
+
+ configuration.setObjectFactory(resource.getElement(), factory);
+ }
+
+ public void addConversationIDFactory(Member member) {
+ ObjectFactory<String> factory = new ConversationIDObjectFactory();
+
+ if (member instanceof Field) {
+ JavaElementImpl element = new JavaElementImpl((Field)member);
+ element.setClassifer(ConversationID.class);
+ configuration.setObjectFactory(element, factory);
+ } else if (member instanceof Method) {
+ JavaElementImpl element = new JavaElementImpl((Method)member, 0);
+ element.setName(JavaIntrospectionHelper.toPropertyName(member.getName()));
+ element.setClassifer(ConversationID.class);
+ configuration.setObjectFactory(element, factory);
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + member.getName());
+ }
+ }
+
+ public boolean implementsCallback(Class callbackClass) {
+ Class<?>[] implementedInterfaces = configuration.getDefinition().getJavaClass().getInterfaces();
+ for (Class<?> implementedInterface : implementedInterfaces) {
+ if (implementedInterface.isAssignableFrom(callbackClass)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ protected Injector<Object> createInjector(Member member, RuntimeWire wire) {
+ if (member instanceof Field) {
+ Class<?> type = ((Field)member).getType();
+ ObjectFactory<?> factory = createWireFactory(type, wire);
+ return new FieldInjector<Object>((Field)member, factory);
+ } else if (member instanceof Method) {
+ Class<?> type = ((Method)member).getParameterTypes()[0];
+ ObjectFactory<?> factory = createWireFactory(type, wire);
+ return new MethodInjector<Object>((Method)member, factory);
+ } else if (member instanceof Constructor) {
+ return null;
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + member.getName());
+ }
+ }
+
+ protected Injector<Object> createMultiplicityInjector(Member member,
+ Class<?> interfaceType,
+ List<RuntimeWire> wireFactories) {
+ List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
+ for (RuntimeWire wire : wireFactories) {
+ factories.add(createWireFactory(interfaceType, wire));
+ }
+ if (member instanceof Field) {
+ Field field = (Field)member;
+ if (field.getType().isArray()) {
+ return new FieldInjector<Object>(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new FieldInjector<Object>(field, new ListMultiplicityObjectFactory(factories));
+ }
+ } else if (member instanceof Method) {
+ Method method = (Method)member;
+ if (method.getParameterTypes()[0].isArray()) {
+ return new MethodInjector<Object>(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new MethodInjector<Object>(method, new ListMultiplicityObjectFactory(factories));
+ }
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + member.getName());
+ }
+ }
+
+ public ComponentContext getComponentContext() {
+ return componentContext;
+ }
+
+ public <B> B getProperty(Class<B> type, String propertyName) {
+ JavaElementImpl element = configuration.getDefinition().getPropertyMembers().get(propertyName);
+ Object obj = configuration.getFactories().get(element);
+ if (obj instanceof ObjectFactory) {
+ return type.cast(((ObjectFactory<?>)obj).getInstance());
+ } else if (obj instanceof List) {
+ List<ObjectFactory<?>> factories = (List<ObjectFactory<?>>)obj;
+ if (type.isArray()) {
+ Object array = Array.newInstance(type, factories.size());
+ for (int i = 0; i < factories.size(); i++) {
+ Array.set(array, i, factories.get(i).getInstance());
+ }
+ return type.cast(array);
+ } else {
+ List<Object> list = new ArrayList<Object>();
+ for (ObjectFactory factory : factories) {
+ list.add(factory.getInstance());
+ }
+ return type.cast(list);
+ }
+ }
+ return null;
+
+ }
+
+ public <B> B getService(Class<B> type, String name) {
+ List<RuntimeWire> referenceWires = getWiresForReference(name);
+ if (referenceWires == null || referenceWires.size() < 1) {
+ return null;
+ } else {
+ // TODO support multiplicity
+ RuntimeWire wire = referenceWires.get(0);
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return factory.getInstance();
+ }
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> type, String name) {
+ List<RuntimeWire> referenceWires = getWiresForReference(name);
+ if (referenceWires == null || referenceWires.size() < 1) {
+ return null;
+ } else {
+ // TODO support multiplicity
+ RuntimeWire wire = referenceWires.get(0);
+ ObjectFactory<B> factory = createWireFactory(type, wire);
+ return new ServiceReferenceImpl<B>(type, factory);
+ }
+ }
+
+ private List<RuntimeWire> getWiresForReference(String name) {
+ for (ComponentReference ref : component.getReferences()) {
+ if (ref.getName().equals(name) || (name.equals("$self$.") && ref.getName().startsWith(name))) {
+ return ((RuntimeComponentReference)ref).getRuntimeWires();
+ }
+ }
+ return null;
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) {
+ return (R)proxyService.cast(target);
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
+ return null;
+ }
+
+ public Object createInstance() throws ObjectCreationException {
+ return createInstanceWrapper().getInstance();
+ }
+
+ public PojoConfiguration<?> getConfiguration() {
+ return configuration;
+ }
+
+ public void stop() {
+ }
+
+ public void removeInstance() throws PersistenceException {
+ ((ScopedRuntimeComponent) component).getScopeContainer().remove();
+ }
+
+ public URI getUri() {
+ return URI.create(component.getURI());
+ }
+
+ public TargetInvoker createTargetInvoker(Operation operation) throws TargetInvokerCreationException {
+ Class<?> implClass = configuration.getImplementationClass();
+
+ try {
+ Method method = JavaInterfaceUtil.findMethod(implClass, operation);
+ boolean passByValue = operation.getInterface().isRemotable() && (!configuration.getDefinition()
+ .isAllowsPassByReference(method));
+
+ TargetInvoker invoker = new JavaTargetInvoker(method, component);
+ if (passByValue) {
+ return new PassByValueInvoker(dataBindingRegistry, operation, method, component);
+ } else {
+ return invoker;
+ }
+ } catch (NoSuchMethodException e) {
+ throw new TargetMethodNotFoundException(operation);
+ }
+
+ }
+
+ protected <B> ObjectFactory<B> createWireFactory(Class<B> interfaze, RuntimeWire wire) {
+ return new WireObjectFactory<B>(interfaze, wire, proxyService);
+ }
+
+ protected ObjectFactory<?> createPropertyValueFactory(ComponentProperty property,
+ Object propertyValue,
+ Class javaType) {
+ return propertyValueFactory.createValueFactory(property, propertyValue, javaType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
new file mode 100644
index 0000000000..61f44dd9b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.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.sca.implementation.java.invocation;
+
+import java.net.URI;
+
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceHost;
+import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopedImplementationProvider;
+import org.apache.tuscany.sca.scope.TargetInvokerCreationException;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProvider implements ScopedImplementationProvider {
+ private JavaImplementation implementation;
+ private JavaComponentInfo atomicComponent;
+
+ public JavaImplementationProvider(
+ RuntimeComponent component,
+ JavaImplementation implementation,
+ ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ super();
+ this.implementation = implementation;
+
+ try {
+ PojoConfiguration configuration = new PojoConfiguration(implementation);
+ configuration.setProxyFactory(proxyService);
+ // FIXME: Group id to be removed
+ configuration.setGroupId(URI.create("/"));
+ atomicComponent = new JavaComponentInfo(component, configuration, dataBindingRegistry,
+ propertyValueObjectFactory);
+
+ Scope scope = getScope();
+
+ if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) {
+ // Nothing
+ } else {
+ // Check for conversational contract if conversational scope
+ if (scope == Scope.CONVERSATION) {
+ boolean hasConversationalContract = false;
+ for (Service serviceDef : implementation.getServices()) {
+ if (serviceDef.getInterfaceContract().getInterface().isConversational()) {
+ hasConversationalContract = true;
+ break;
+ }
+ }
+ if (!hasConversationalContract) {
+ String name = implementation.getJavaClass().getName();
+ throw new NoConversationalContractException(name);
+ }
+ }
+ }
+
+ if (implementation.getConversationIDMember() != null) {
+ atomicComponent.addConversationIDFactory(implementation.getConversationIDMember());
+ }
+
+ atomicComponent.configureProperties(component.getProperties());
+ handleResources(implementation, atomicComponent);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+
+ }
+
+ private void handleResources(JavaImplementation componentType, JavaComponentInfo component) {
+ for (JavaResourceImpl resource : componentType.getResources().values()) {
+ String name = resource.getName();
+
+ ObjectFactory<?> objectFactory = (ObjectFactory<?>)component.getConfiguration().getFactories().get(resource
+ .getElement());
+ Class<?> type = resource.getElement().getType();
+ if (ComponentContext.class.equals(type)) {
+ objectFactory = new PojoComponentContextFactory(component);
+ } else {
+ boolean optional = resource.isOptional();
+ String mappedName = resource.getMappedName();
+ objectFactory = createResourceObjectFactory(type, mappedName, optional, null);
+ }
+ component.addResourceFactory(name, objectFactory);
+ }
+ }
+
+ private <T> ResourceObjectFactory<T> createResourceObjectFactory(Class<T> type,
+ String mappedName,
+ boolean optional,
+ ResourceHost host) {
+ return new ResourceObjectFactory<T>(type, mappedName, optional, host);
+ }
+
+ public Object createInstance(RuntimeComponent component, ComponentService service) {
+ return atomicComponent.createInstance();
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ try {
+ return new TargetInvokerInvoker(atomicComponent.createTargetInvoker(operation));
+ } catch (TargetInvokerCreationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ try {
+ return new TargetInvokerInvoker(atomicComponent.createTargetInvoker(operation));
+ } catch (TargetInvokerCreationException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ public Scope getScope() {
+ return new Scope(implementation.getJavaScope().getScope());
+ }
+
+ public void start() {
+ atomicComponent.start();
+ }
+
+ public void stop() {
+ atomicComponent.stop();
+ }
+
+ public InstanceWrapper createInstanceWrapper() {
+ return atomicComponent.createInstanceWrapper();
+ }
+
+ public boolean isEagerInit() {
+ return implementation.isEagerInit();
+ }
+
+ public long getMaxAge() {
+ return implementation.getMaxAge();
+ }
+
+ public long getMaxIdleTime() {
+ return implementation.getMaxIdleTime();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
new file mode 100644
index 0000000000..1be465cc51
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationProviderFactory implements ImplementationProviderFactory<JavaImplementation> {
+ private JavaPropertyValueObjectFactory propertyValueObjectFactory;
+ private DataBindingExtensionPoint dataBindingRegistry;
+ private ProxyFactory proxyService;
+
+ public JavaImplementationProviderFactory(ProxyFactory proxyService,
+ DataBindingExtensionPoint dataBindingRegistry,
+ JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ super();
+ this.proxyService = proxyService;
+ this.dataBindingRegistry = dataBindingRegistry;
+ this.propertyValueObjectFactory = propertyValueObjectFactory;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component,
+ JavaImplementation implementation) {
+ return new JavaImplementationProvider(component, implementation, proxyService, dataBindingRegistry,
+ propertyValueObjectFactory);
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaTargetInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaTargetInvoker.java
new file mode 100644
index 0000000000..03eca2ff6b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaTargetInvoker.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.implementation.java.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.InstanceWrapper;
+import org.apache.tuscany.sca.scope.Scope;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.scope.ScopedRuntimeComponent;
+import org.apache.tuscany.sca.scope.TargetResolutionException;
+
+/**
+ * Responsible for synchronously dispatching an invocation to a Java component
+ * implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaTargetInvoker implements TargetInvoker {
+ protected Method operation;
+ protected boolean stateless;
+ protected InstanceWrapper target;
+ protected boolean cacheable;
+
+ private final RuntimeComponent component;
+ private final ScopeContainer scopeContainer;
+
+ public JavaTargetInvoker(Method operation, RuntimeComponent component) {
+ assert operation != null : "Operation method cannot be null";
+ this.operation = operation;
+ this.component = component;
+ this.scopeContainer = ((ScopedRuntimeComponent) component).getScopeContainer();
+ stateless = Scope.STATELESS == this.scopeContainer.getScope();
+ }
+
+ @Override
+ public JavaTargetInvoker clone() throws CloneNotSupportedException {
+ try {
+ JavaTargetInvoker invoker = (JavaTargetInvoker)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 getInstance(ConversationSequence sequence, Object contextId)
+ throws TargetResolutionException, InvalidConversationSequenceException {
+ if (sequence == null) {
+ if (cacheable) {
+ if (target == null) {
+ target = scopeContainer.getWrapper(contextId);
+ }
+ return target;
+ } else {
+ return scopeContainer.getWrapper(contextId);
+ }
+ } else {
+ switch (sequence) {
+ case CONVERSATION_START:
+ assert !cacheable;
+ return scopeContainer.getWrapper(contextId);
+ case CONVERSATION_CONTINUE:
+ case CONVERSATION_END:
+ assert !cacheable;
+ return scopeContainer.getAssociatedWrapper(contextId);
+ default:
+ throw new InvalidConversationSequenceException("Unknown sequence type: " + String.valueOf(sequence));
+ }
+ }
+ }
+
+ public Object invokeTarget(final Object payload, final ConversationSequence sequence)
+ throws InvocationTargetException {
+
+ // FIXME: How to deal with other scopes
+ Object contextId = ThreadMessageContext.getMessageContext().getConversationID();
+ try {
+ InstanceWrapper wrapper = getInstance(sequence, contextId);
+ Object instance = wrapper.getInstance();
+ Object ret;
+ if (payload != null && !payload.getClass().isArray()) {
+ ret = operation.invoke(instance, payload);
+ } else {
+ ret = operation.invoke(instance, (Object[])payload);
+ }
+ scopeContainer.returnWrapper(wrapper, contextId);
+ if (sequence == ConversationSequence.CONVERSATION_END) {
+ // if end conversation, remove resource
+ scopeContainer.remove();
+ }
+ return ret;
+ } catch (InvocationTargetException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object messageId = msg.getMessageID();
+ Message workContext = ThreadMessageContext.getMessageContext();
+ if (messageId != null) {
+ workContext.setCorrelationID(messageId);
+ }
+ Object resp = invokeTarget(msg.getBody(), msg.getConversationSequence());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ protected InvocationChain getInvocationChain(List<InvocationChain> chains, Operation targetOperation) {
+ for (InvocationChain chain : chains) {
+ if (chain.getTargetOperation().equals(targetOperation)) {
+ return chain;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java
new file mode 100644
index 0000000000..a7b175cf9b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.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.implementation.java.invocation;
+
+
+/**
+ * Raised when a component has conversational scope but no conversational contract
+ *
+ * @version $Rev: 487877 $ $Date: 2006-12-16 15:32:16 -0500 (Sat, 16 Dec 2006) $
+ */
+public class NoConversationalContractException extends Exception {
+
+ private static final long serialVersionUID = -1157790036638157539L;
+
+ public NoConversationalContractException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PassByValueInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PassByValueInvoker.java
new file mode 100644
index 0000000000..e9e12b9b7b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PassByValueInvoker.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.implementation.java.invocation;
+
+import java.lang.reflect.Method;
+import java.util.IdentityHashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.databinding.DataBinding;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * An interceptor to enforce pass-by-value semantics for remotable interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public class PassByValueInvoker extends JavaTargetInvoker {
+ private DataBindingExtensionPoint registry;
+ private Operation operation;
+
+ /**
+ * @param registry
+ * @param operation
+ * @param method
+ * @param component
+ */
+ public PassByValueInvoker(DataBindingExtensionPoint registry,
+ Operation operation,
+ Method method,
+ RuntimeComponent component) {
+ super(method, component);
+ this.registry = registry;
+ this.operation = operation;
+ }
+
+ public Message invoke(Message msg) {
+ Object obj = msg.getBody();
+ msg.setBody(copy((Object[])obj));
+
+ Message result = super.invoke(msg);
+
+ if (!result.isFault() && operation.getOutputType() != null) {
+ String dataBindingId = operation.getOutputType().getDataBinding();
+ DataBinding dataBinding = registry.getDataBinding(dataBindingId);
+ result.setBody(copy(result.getBody(), dataBinding));
+ }
+ return result;
+ }
+
+ public Object[] copy(Object[] args) {
+ if (args == null) {
+ return null;
+ }
+ Object[] copiedArgs = new Object[args.length];
+ Map<Object, Object> map = new IdentityHashMap<Object, Object>();
+ for (int i = 0; i < args.length; i++) {
+ if (args[i] == null) {
+ copiedArgs[i] = null;
+ } else {
+ Object copiedArg = map.get(args[i]);
+ if (copiedArg != null) {
+ copiedArgs[i] = copiedArg;
+ } else {
+ String dataBindingId = operation.getInputType().getLogical().get(i).getDataBinding();
+ DataBinding dataBinding = registry.getDataBinding(dataBindingId);
+ copiedArg = copy(args[i], dataBinding);
+ map.put(args[i], copiedArg);
+ copiedArgs[i] = copiedArg;
+ }
+ }
+ }
+ return copiedArgs;
+ }
+
+ public Object copy(Object arg, DataBinding argDataBinding) {
+ if (arg == null) {
+ return null;
+ }
+ Object copiedArg;
+ if (argDataBinding != null) {
+ copiedArg = argDataBinding.copy(arg);
+ } else {
+ copiedArg = arg;
+ DataType<?> dataType = registry.introspectType(arg);
+ if (dataType != null) {
+ DataBinding binding = registry.getDataBinding(dataType.getDataBinding());
+ if (binding != null) {
+ copiedArg = binding.copy(arg);
+ }
+ }
+ // FIXME: What to do if it's not recognized?
+ }
+ return copiedArg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentContextFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentContextFactory.java
new file mode 100644
index 0000000000..612262ffb4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentContextFactory.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PojoComponentContextFactory implements ObjectFactory<ComponentContext> {
+ private final JavaComponentInfo component;
+
+
+ public PojoComponentContextFactory(JavaComponentInfo component) {
+ this.component = component;
+ }
+
+
+ public ComponentContext getInstance() throws ObjectCreationException {
+ return component.getComponentContext();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoConfiguration.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoConfiguration.java
new file mode 100644
index 0000000000..bd8c66f914
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoConfiguration.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.invocation;
+
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.context.InstanceFactory;
+import org.apache.tuscany.sca.implementation.java.context.InstanceFactoryProvider;
+import org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.EventInvoker;
+import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
+import org.apache.tuscany.sca.implementation.java.injection.Injector;
+import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
+import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
+import org.apache.tuscany.sca.implementation.java.injection.MethodEventInvoker;
+import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * Encapsulates confuration for a Java-based atomic component
+ *
+ * @version $Rev$ $Date$
+ */
+public class PojoConfiguration<T> implements InstanceFactoryProvider<T> {
+ private JavaImplementation definition;
+ private ProxyFactory proxyService;
+ private URI groupId;
+ private URI name;
+
+ private final List<JavaElementImpl> injectionSites;
+ private final EventInvoker<T> initInvoker;
+ private final EventInvoker<T> destroyInvoker;
+ private final Map<JavaElementImpl, Object> factories = new HashMap<JavaElementImpl, Object>();
+
+ public PojoConfiguration(JavaImplementation definition) {
+ this.definition = definition;
+ this.initInvoker = definition.getInitMethod() == null ? null : new MethodEventInvoker<T>(definition
+ .getInitMethod());
+ this.destroyInvoker = definition.getDestroyMethod() == null ? null : new MethodEventInvoker<T>(definition
+ .getDestroyMethod());
+ injectionSites = new ArrayList<JavaElementImpl>();
+ }
+
+ public URI getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(URI groupId) {
+ this.groupId = groupId;
+ }
+
+ public EventInvoker<Object> getInitInvoker() {
+ if (definition.getInitMethod() != null) {
+ return new MethodEventInvoker<Object>(definition.getInitMethod());
+ } else {
+ return null;
+ }
+ }
+
+ public EventInvoker<Object> getDestroyInvoker() {
+ if (definition.getDestroyMethod() != null) {
+ return new MethodEventInvoker<Object>(definition.getDestroyMethod());
+ } else {
+ return null;
+ }
+ }
+
+ public ProxyFactory getProxyFactory() {
+ return proxyService;
+ }
+
+ public void setProxyFactory(ProxyFactory proxyService) {
+ this.proxyService = proxyService;
+ }
+
+ /**
+ * @return the constructor
+ */
+ public JavaConstructorImpl<?> getConstructor() {
+ return definition.getConstructor();
+ }
+
+ /**
+ * @return the definition
+ */
+ public JavaImplementation getDefinition() {
+ return definition;
+ }
+
+ @SuppressWarnings("unchecked")
+ public InstanceFactory<T> createFactory() {
+ ObjectFactory<?>[] initArgs = getConstructorArgs();
+ Injector<T>[] injectors = getInjectors();
+ return new ReflectiveInstanceFactory<T>((Constructor<T>)definition.getConstructor().getConstructor(),
+ initArgs, injectors, initInvoker, destroyInvoker);
+ }
+
+ protected ObjectFactory<?>[] getConstructorArgs() {
+ JavaConstructorImpl<?> constructor = definition.getConstructor();
+ ObjectFactory<?>[] initArgs = new ObjectFactory<?>[constructor.getParameters().length];
+ for (int i = 0; i < initArgs.length; i++) {
+ ObjectFactory<?> factory = (ObjectFactory<?>)factories.get(constructor.getParameters()[i]);
+ assert factory != null;
+ initArgs[i] = factory;
+ }
+ return initArgs;
+ }
+
+ protected Injector<T>[] getInjectors() {
+ // work around JDK1.5 issue with allocating generic arrays
+ @SuppressWarnings("unchecked")
+ Injector<T>[] injectors = (Injector<T>[])new Injector[injectionSites.size()];
+
+ int i = 0;
+ for (JavaElementImpl element : injectionSites) {
+ Object obj = factories.get(element);
+ if (obj != null) {
+ if (obj instanceof ObjectFactory) {
+ ObjectFactory<?> factory = (ObjectFactory<?>)obj;
+ Member member = (Member)element.getAnchor();
+ if (element.getElementType() == ElementType.FIELD) {
+ injectors[i++] = new FieldInjector<T>((Field)member, factory);
+ } else if (element.getElementType() == ElementType.PARAMETER && member instanceof Method) {
+ injectors[i++] = new MethodInjector<T>((Method)member, factory);
+ } else if (member instanceof Constructor) {
+ // Ignore
+ } else {
+ throw new AssertionError(String.valueOf(element));
+ }
+ } else {
+ injectors[i++] = createMultiplicityInjector(element, (List<ObjectFactory<?>>)obj);
+ }
+ }
+ }
+ return injectors;
+ }
+
+ protected Injector<T> createMultiplicityInjector(JavaElementImpl element, List<ObjectFactory<?>> factories) {
+ Class<?> interfaceType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+
+ if (element.getAnchor() instanceof Field) {
+ Field field = (Field)element.getAnchor();
+ if (field.getType().isArray()) {
+ return new FieldInjector<T>(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new FieldInjector<T>(field, new ListMultiplicityObjectFactory(factories));
+ }
+ } else if (element.getAnchor() instanceof Method) {
+ Method method = (Method)element.getAnchor();
+ if (method.getParameterTypes()[0].isArray()) {
+ return new MethodInjector<T>(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
+ } else {
+ return new MethodInjector<T>(method, new ListMultiplicityObjectFactory(factories));
+ }
+ } else {
+ throw new InvalidAccessorException("Member must be a field or method: " + element.getName());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public Class<T> getImplementationClass() {
+ return (Class<T>)definition.getJavaClass();
+ }
+
+ public void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory) {
+ factories.put(element, objectFactory);
+ }
+
+ public void setObjectFactories(JavaElementImpl element, List<ObjectFactory<?>> objectFactory) {
+ factories.put(element, objectFactory);
+ }
+
+ /**
+ * @return the injectionSites
+ */
+ public List<JavaElementImpl> getInjectionSites() {
+ return injectionSites;
+ }
+
+ /**
+ * @return the factories
+ */
+ public Map<JavaElementImpl, Object> getFactories() {
+ return factories;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvoker.java
new file mode 100644
index 0000000000..5e390f1c45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvoker.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.implementation.java.invocation;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Implementations are responsible for resolving a target and performing the actual invocation on it, for example, a
+ * component implementation instance or a service client.
+ *
+ * @version $Rev$ $Date$
+ * @Deprecated
+ */
+public interface TargetInvoker extends Cloneable {
+
+ /**
+ * Invokes an operation on a target with the given payload. Used in optmized cases where messages do not need to be
+ * flowed such as in non-proxied wires.
+ *
+ * @param payload the invocation payload, typically an array of parameters
+ * @param sequence if the invocation is part of a conversation, the sequence. Valid values are {@link #NONE} for
+ * non-conversational, {@link #START} to begin a conversation, {@link #CONTINUE} to continue a
+ * conversation, or {@link #END} to end a conversation
+ * @return the result of the invocation
+ * @throws InvocationTargetException if there was a problem invoking the target
+ */
+ Object invokeTarget(final Object payload, final ConversationSequence sequence) throws InvocationTargetException;
+
+ /**
+ * Invokes an operation on a target with the given message
+ */
+ Message invoke(Message msg);
+
+ /**
+ * Determines whether the proxy can be cached on the client/source side
+ */
+ boolean isCacheable();
+
+ /**
+ * Sets whether the target service instance may be cached by the invoker. This is a possible optimization when a
+ * wire is configured for a "down-scope" reference, i.e. a reference from a source of a shorter lifetime to a source
+ * of greater lifetime.
+ */
+ void setCacheable(boolean cacheable);
+
+ /**
+ * Implementations must support deep cloning
+ */
+ Object clone() throws CloneNotSupportedException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvokerInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvokerInvoker.java
new file mode 100644
index 0000000000..3842f0ba52
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/TargetInvokerInvoker.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.implementation.java.invocation;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+
+/**
+ * Serves as a tail interceptor on a target wire chain. This implementation dispatches to the target invoker passed
+ * inside the wire message. Target invokers are passed from the source in order to allow for caching of target
+ * instances.
+ *
+ * @version $Rev$ $Date$
+ * @Deprecated
+ * @see org.apache.tuscany.sca.implementation.java.invocation.TargetInvoker
+ */
+public class TargetInvokerInvoker implements Invoker {
+ private TargetInvoker invoker;
+
+ public TargetInvokerInvoker(TargetInvoker invoker) {
+ this.invoker = invoker;
+ }
+
+ public Message invoke(Message msg) {
+ if (invoker == null) {
+ throw new ServiceRuntimeException("No target invoker specified on message");
+ }
+ return invoker.invoke(msg);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
new file mode 100644
index 0000000000..626737ceb7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.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.implementation.java.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.core.invocation.JDKProxyService;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
+import org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaRuntimeModuleActivator implements ModuleActivator {
+
+ private JavaClassIntrospectorExtensionPoint classVisitors;
+
+ public JavaRuntimeModuleActivator() {
+ }
+
+
+ public Object[] getExtensionPoints() {
+ classVisitors = new DefaultJavaClassIntrospectorExtensionPoint();
+ return new Object[] { classVisitors };
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ PolicyFactory policyFactory = factories.getFactory(PolicyFactory.class);
+
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+
+ JDKProxyService proxyFactory = (JDKProxyService) registry.getExtensionPoint(ProxyFactory.class);
+
+ JavaInterfaceIntrospectorExtensionPoint interfaceVisitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ JavaInterfaceIntrospector interfaceIntrospector = new ExtensibleJavaInterfaceIntrospector(javaFactory, interfaceVisitors);
+ BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
+ new ConstructorProcessor(assemblyFactory),
+ new AllowsPassByReferenceProcessor(assemblyFactory),
+ new ContextProcessor(assemblyFactory),
+ new ConversationProcessor(assemblyFactory),
+ new DestroyProcessor(assemblyFactory),
+ new EagerInitProcessor(assemblyFactory),
+ new InitProcessor(assemblyFactory),
+ new PropertyProcessor(assemblyFactory),
+ new ReferenceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new ResourceProcessor(assemblyFactory),
+ new ScopeProcessor(assemblyFactory),
+ new ServiceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new PolicyProcessor(assemblyFactory, policyFactory)
+ };
+ for (JavaClassVisitor extension : extensions) {
+ classVisitors.addClassVisitor(extension);
+ }
+ JavaClassIntrospector classIntrospector = new ExtensibleJavaClassIntrospector(classVisitors);
+
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator =new MediatorImpl(dataBindings, transformers);
+ JavaPropertyValueObjectFactory factory = new JavaPropertyValueObjectFactory(mediator);
+
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ JavaImplementationProcessor javaImplementationProcessor =
+ new JavaImplementationProcessor(assemblyFactory, policyFactory, javaImplementationFactory, classIntrospector);
+ processors.addArtifactProcessor(javaImplementationProcessor);
+
+ JavaImplementationProviderFactory javaImplementationProviderFactory =
+ new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(javaImplementationProviderFactory);
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatter.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatter.java
new file mode 100644
index 0000000000..dc34153389
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatter.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.implementation.java.monitor;
+
+import java.io.PrintWriter;
+
+/**
+ * Formats exception data during a monitor event
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ExceptionFormatter {
+
+ boolean canFormat(Class<?> type);
+
+ PrintWriter write(PrintWriter writer, Throwable exception);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterImpl.java
new file mode 100644
index 0000000000..3fa86109a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterImpl.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.implementation.java.monitor;
+
+import java.io.PrintWriter;
+
+/**
+ * Performs basics formatting of exceptions for JDK logging
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExceptionFormatterImpl implements ExceptionFormatter {
+
+ public ExceptionFormatterImpl() {
+ }
+
+ public boolean canFormat(Class<?> type) {
+ return Throwable.class.isAssignableFrom(type);
+ }
+
+ public PrintWriter write(PrintWriter writer, Throwable exception) {
+ writer.append(exception.getMessage());
+ writer.append("\n");
+ return writer;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/FormatterRegistry.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/FormatterRegistry.java
new file mode 100644
index 0000000000..91a8223385
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/FormatterRegistry.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.sca.implementation.java.monitor;
+
+/**
+ * A registry for exception formatters
+ *
+ * @version $Rev$ $Date$
+ */
+public interface FormatterRegistry {
+
+ /**
+ * Registers the given formatter
+ *
+ * @param formatter the formatter to register
+ */
+ void register(ExceptionFormatter formatter);
+
+ /**
+ * De-registers the given formatter
+ *
+ * @param formatter the formatter to de-register
+ */
+ void unregister(ExceptionFormatter formatter);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/InvalidLevelException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/InvalidLevelException.java
new file mode 100644
index 0000000000..636451bc36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/InvalidLevelException.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.implementation.java.monitor;
+
+/**
+ * Exception indicating an invalid log level has been passed.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidLevelException extends IllegalArgumentException {
+ private static final long serialVersionUID = 7767234706427841915L;
+ private final String method;
+ private final String level;
+
+ /**
+ * Constructor specifying the method name and the level affected.
+ *
+ * @param method the name of the method being monitored
+ * @param level the invalid log level value
+ */
+ public InvalidLevelException(String method, String level) {
+ super();
+ this.method = method;
+ this.level = level;
+ }
+
+ /**
+ * Returns the name of the method being monitored.
+ *
+ * @return the name of the method being monitored
+ */
+ public String getMethod() {
+ return method;
+ }
+
+ /**
+ * Returns the invalid log level specified.
+ *
+ * @return the invalid log level that was specified
+ */
+ public String getLevel() {
+ return level;
+ }
+
+ public String getMessage() {
+ return "Invalid level for method " + method + " : " + level;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingMonitorFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingMonitorFactory.java
new file mode 100644
index 0000000000..fdfd43be95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingMonitorFactory.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.sca.implementation.java.monitor;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import org.osoa.sca.annotations.Service;
+
+
+/**
+ * A factory for monitors that forwards events to a {@link java.util.logging.Logger Java Logging (JSR47) Logger}.
+ *
+ * @version $Rev$ $Date$
+ * @see java.util.logging
+ */
+@Service(interfaces = {MonitorFactory.class, FormatterRegistry.class})
+public class JavaLoggingMonitorFactory extends ProxyMonitorFactory {
+
+ /**
+ * Construct a MonitorFactory that will monitor the specified methods at the specified levels and generate messages
+ * using java.util.logging.
+ * <p/>
+ * The supplied Properties can be used to specify custom log levels for specific monitor methods. The key should be
+ * the method name in form returned by <code>Class.getName() + '#' + Method.getName()</code> and the value the log
+ * level to use as defined by {@link java.util.logging.Level}.
+ *
+ * @param levels definition of custom levels for specific monitored methods, may be null or empty.
+ * @param defaultLevel the default log level to use
+ * @param bundleName the name of a resource bundle that will be passed to the logger
+ * @see java.util.logging.Logger
+ */
+ public JavaLoggingMonitorFactory(Properties levels, Level defaultLevel, String bundleName) {
+ Map<String, Object> configProperties = new HashMap<String, Object>();
+ configProperties.put("levels", levels);
+ configProperties.put("defaultLevel", defaultLevel);
+ configProperties.put("bundleName", bundleName);
+ initInternal(configProperties);
+ }
+
+ /**
+ * Constructs a MonitorFactory that needs to be subsequently configured via a call to {@link #initialize}.
+ */
+ public JavaLoggingMonitorFactory() {
+ }
+
+ protected <T> InvocationHandler createInvocationHandler(Class<T> monitorInterface,
+ Map<String, Level> levels) {
+ ResourceBundle bundle = locateBundle(monitorInterface, bundleName);
+ Logger logger = Logger.getLogger(monitorInterface.getName());
+ return new LoggingHandler(logger, levels, bundle);
+ }
+
+ private class LoggingHandler implements InvocationHandler {
+ private final Logger logger;
+ private final Map<String, Level> methodLevels;
+ private final ResourceBundle bundle;
+
+ public LoggingHandler(Logger logger,
+ Map<String, Level> methodLevels,
+ ResourceBundle bundle
+ ) {
+ this.logger = logger;
+ this.methodLevels = methodLevels;
+ this.bundle = bundle;
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ String sourceMethod = method.getName();
+ Level level = methodLevels.get(sourceMethod);
+ if (level != null && logger.isLoggable(level)) {
+ // construct the key for the resource bundle
+ String className = logger.getName();
+ String key = className + '#' + sourceMethod;
+
+ LogRecord logRecord = new LogRecord(level, key);
+ logRecord.setLoggerName(className);
+ logRecord.setSourceClassName(className);
+ logRecord.setSourceMethodName(sourceMethod);
+ logRecord.setParameters(args);
+ if (args != null) {
+ for (Object o : args) {
+ if (o instanceof Throwable) {
+ logRecord.setMessage(formatException((Throwable) o));
+ break;
+ }
+ }
+ }
+ logRecord.setResourceBundle(bundle);
+ logger.log(logRecord);
+ }
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactory.java
new file mode 100644
index 0000000000..9337e72dcb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactory.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.implementation.java.monitor;
+
+import java.util.Map;
+
+
+/**
+ * A MonitorFactory creates implementations of components' monitor interfaces that interface with a its monitoring
+ * scheme. For example, a implementation may create versions that emit appropriate logging events or which send
+ * notifications to a management API.
+ * <p/>
+ * MonitorFactory implementations must provide a no-arg constructor and implement the {@link #initialize} method to
+ * perform configuration of instances created using that constructor. Additional constructors may be defined; typically
+ * their implementations delegate to {@link #initialize}.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface MonitorFactory extends FormatterRegistry {
+ /**
+ * Initializes MonitorFactory instances with implementation-specific configuration properties.
+ *
+ * @param configProperties a map of named configuration properties. May be null.
+ * @throws IllegalArgumentException if the instance can't be configured using the supplied properties
+ */
+ void initialize(Map<String, Object> configProperties);
+
+ /**
+ * Return a monitor for a component's monitor interface.
+ *
+ * @param monitorInterface the component's monitoring interface
+ * @return an implementation of the monitoring interface; will not be null
+ */
+ <T> T getMonitor(Class<T> monitorInterface);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactoryUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactoryUtil.java
new file mode 100644
index 0000000000..529ceee5ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/MonitorFactoryUtil.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.implementation.java.monitor;
+
+
+import java.util.Map;
+
+/**
+ * Helper for creating MonitorFactory instances.
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+
+public final class MonitorFactoryUtil {
+ /**
+ * Hide the constructor
+ */
+ private MonitorFactoryUtil() {
+ }
+
+ /**
+ * Creates a MonitorFactory instance of the specified type.
+ * @param name fully qualified classname of the desired MonitorFactory type
+ * @param props collection of initialization properties
+ * @return a configured MonitorFactory instance, or null if the factory could not be instantiated.
+ */
+ @SuppressWarnings("unchecked")
+ public static MonitorFactory createMonitorFactory(String name, Map<String, Object> props) {
+ Class<? extends MonitorFactory> clazz;
+ try {
+ clazz = (Class<? extends MonitorFactory>) Class.forName(name);
+ } catch (ClassNotFoundException cnfe) {
+ return null;
+ } catch (ClassCastException cce) {
+ return null;
+ }
+
+ return createMonitorFactory(clazz, props);
+ }
+
+ /**
+ * Creates a MonitorFactory instance of the specified type.
+ * @param mfc class of the desired MonitorFactory type
+ * @param props collection of initialization properties
+ * @return a configured MonitorFactory instance, or null if the factory could not be instantiated.
+ */
+ public static MonitorFactory createMonitorFactory(Class<? extends MonitorFactory> mfc, Map<String, Object> props) {
+ MonitorFactory mf;
+ try {
+ mf = mfc.newInstance();
+ mf.initialize(props);
+ } catch (InstantiationException e) {
+ throw new AssertionError(e);
+ } catch (IllegalAccessException e) {
+ throw new AssertionError(e);
+ }
+ // allow IllegalArgumentException to propogate out
+
+ return mf;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/NullMonitorFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/NullMonitorFactory.java
new file mode 100644
index 0000000000..efabb2ef9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/NullMonitorFactory.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.sca.implementation.java.monitor;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Map;
+
+import org.osoa.sca.annotations.EagerInit;
+
+
+/**
+ * Implementation of a {@link MonitorFactory} that produces implementations that simply return.
+ *
+ * @version $Rev$ $Date$
+ */
+@EagerInit
+public class NullMonitorFactory implements MonitorFactory {
+
+ /**
+ * Singleton hander that does nothing.
+ */
+ private static final InvocationHandler NULL_MONITOR = new InvocationHandler() {
+ public Object invoke(Object proxy, Method method, Object[] args) {
+ return null;
+ }
+ };
+
+ public void initialize(Map<String, Object> configProperties) {
+ }
+
+ public <T> T getMonitor(Class<T> monitorInterface) {
+ /*
+ * This uses a reflection proxy to implement the monitor interface which
+ * is a simple but perhaps not very performant solution. Performance
+ * might be improved by code generating an implementation with empty methods.
+ */
+ return monitorInterface.cast(
+ Proxy.newProxyInstance(monitorInterface.getClassLoader(), new Class<?>[]{monitorInterface}, NULL_MONITOR));
+ }
+
+ public void register(ExceptionFormatter formatter) {
+
+ }
+
+ public void unregister(ExceptionFormatter formatter) {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ProxyMonitorFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ProxyMonitorFactory.java
new file mode 100644
index 0000000000..b26ba6ca8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ProxyMonitorFactory.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.monitor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.Properties;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+import java.util.logging.Level;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class ProxyMonitorFactory implements MonitorFactory, FormatterRegistry {
+ protected String bundleName;
+ protected final List<ExceptionFormatter> formatters = new ArrayList<ExceptionFormatter>();
+ protected final ExceptionFormatter defaultFormatter = new ExceptionFormatterImpl();
+ protected Level defaultLevel;
+ protected Map<String, Level> levels;
+ private final Map<Class<?>, WeakReference<?>> proxies = new WeakHashMap<Class<?>, WeakReference<?>>();
+
+ public void initialize(Map<String, Object> configProperties) {
+ if (configProperties == null) {
+ return;
+ }
+ initInternal(configProperties);
+ }
+
+ protected void initInternal(Map<String, Object> configProperties) {
+ try {
+ this.defaultLevel = (Level) configProperties.get("defaultLevel");
+ this.bundleName = (String) configProperties.get("bundleName");
+ Properties levels = (Properties) configProperties.get("levels");
+
+ this.levels = new HashMap<String, Level>();
+ if (levels != null) {
+ for (Map.Entry<Object, Object> entry : levels.entrySet()) {
+ String method = (String) entry.getKey();
+ String level = (String) entry.getValue();
+ try {
+ this.levels.put(method, Level.parse(level));
+ } catch (IllegalArgumentException e) {
+ throw new InvalidLevelException(method, level);
+ }
+ }
+ }
+ } catch (ClassCastException cce) {
+ throw new IllegalArgumentException(cce.getLocalizedMessage());
+ }
+ }
+
+ public synchronized <T> T getMonitor(Class<T> monitorInterface) {
+ T proxy = getCachedMonitor(monitorInterface);
+ if (proxy == null) {
+ proxy = createMonitor(monitorInterface);
+ proxies.put(monitorInterface, new WeakReference<T>(proxy));
+ }
+ return proxy;
+ }
+
+ protected <T> T getCachedMonitor(Class<T> monitorInterface) {
+ WeakReference<?> ref = proxies.get(monitorInterface);
+ return (ref != null) ? monitorInterface.cast(ref.get()) : null;
+ }
+
+ protected <T> T createMonitor(Class<T> monitorInterface) {
+ String className = monitorInterface.getName();
+ Method[] methods = monitorInterface.getMethods();
+ Map<String, Level> levels = new HashMap<String, Level>(methods.length);
+ for (Method method : methods) {
+ String key = className + '#' + method.getName();
+ Level level = null;
+ if (this.levels != null) {
+ this.levels.get(key);
+ }
+ // if not specified the in config properties, look for an annotation on the method
+ if (level == null) {
+ LogLevel annotation = method.getAnnotation(LogLevel.class);
+ if (annotation != null && annotation.value() != null) {
+ try {
+ level = Level.parse(annotation.value());
+ } catch (IllegalArgumentException e) {
+ // bad value, just use the default
+ level = defaultLevel;
+ }
+ }
+ }
+ if (level == null) {
+ level = defaultLevel;
+ }
+ levels.put(method.getName(), level);
+ }
+
+ InvocationHandler handler = createInvocationHandler(monitorInterface, levels);
+ Object proxy = Proxy.newProxyInstance(monitorInterface.getClassLoader(),
+ new Class<?>[]{monitorInterface},
+ handler);
+ return monitorInterface.cast(proxy);
+ }
+
+ protected <T> ResourceBundle locateBundle(Class<T> monitorInterface, String bundleName) {
+ Locale locale = Locale.getDefault();
+ ClassLoader cl = monitorInterface.getClassLoader();
+ String packageName = monitorInterface.getPackage().getName();
+ while (true) {
+ try {
+ return ResourceBundle.getBundle(packageName + '.' + bundleName, locale, cl);
+ } catch (MissingResourceException e) {
+ //ok
+ }
+ int index = packageName.lastIndexOf('.');
+ if (index == -1) {
+ break;
+ }
+ packageName = packageName.substring(0, index);
+ }
+ try {
+ return ResourceBundle.getBundle(bundleName, locale, cl);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ public void register(ExceptionFormatter formatter) {
+ formatters.add(formatter);
+ }
+
+ public void unregister(ExceptionFormatter formatter) {
+ formatters.remove(formatter);
+ }
+
+ protected abstract <T> InvocationHandler createInvocationHandler(Class<T> monitorInterface,
+ Map<String, Level> levels);
+
+ protected String formatException(Throwable e) {
+ ExceptionFormatter formatter = defaultFormatter;
+ for (ExceptionFormatter candidate : formatters) {
+ if (candidate.canFormat(e.getClass())) {
+ formatter = candidate;
+ break;
+ }
+ }
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ formatter.write(pw, e);
+ format(pw, e);
+ pw.close();
+ return writer.toString();
+ }
+
+ protected void format(PrintWriter writer, Throwable throwable) {
+ writer.println(throwable.getClass().getName());
+ StackTraceElement[] trace = throwable.getStackTrace();
+ for (StackTraceElement aTrace : trace) {
+ writer.println("\tat " + aTrace);
+ }
+ Throwable ourCause = throwable.getCause();
+
+ if (ourCause != null) {
+ printStackTraceAsCause(writer, ourCause, trace);
+ }
+ }
+
+ protected void printStackTraceAsCause(PrintWriter pw,
+ Throwable throwable,
+ StackTraceElement[] causedTrace) {
+
+ // Compute number of frames in common between this and caused
+ StackTraceElement[] trace = throwable.getStackTrace();
+ int m = trace.length - 1;
+ int n = causedTrace.length - 1;
+ while (m >= 0 && n >= 0 && trace[m].equals(causedTrace[n])) {
+ m--;
+ n--;
+ }
+ int framesInCommon = trace.length - 1 - m;
+
+ pw.println("Caused by: " + throwable.getClass().getName());
+
+ ExceptionFormatter formatter = defaultFormatter;
+ for (ExceptionFormatter candidate : formatters) {
+ if (candidate.canFormat(throwable.getClass())) {
+ formatter = candidate;
+ break;
+ }
+ }
+ formatter.write(pw, throwable);
+
+ for (int i = 0; i <= m; i++) {
+ pw.println("\tat " + trace[i]);
+ }
+ if (framesInCommon != 0) {
+ pw.println("\t... " + framesInCommon + " more");
+ }
+
+ // Recurse if we have a cause
+ Throwable ourCause = throwable.getCause();
+ if (ourCause != null) {
+ printStackTraceAsCause(pw, ourCause, trace);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..0871ddf4be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ModelHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ModelHelper.java
new file mode 100644
index 0000000000..9b65af0ab1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ModelHelper.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.sca.implementation.java.context;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ModelHelper {
+
+ public static Property getProperty(JavaImplementation type, String name) {
+ for (Property prop : type.getProperties()) {
+ if (prop.getName().equals(name)) {
+ return prop;
+ }
+ }
+ return null;
+ }
+
+ public static Reference getReference(JavaImplementation type, String name) {
+ for (Reference ref : type.getReferences()) {
+ if (ref.getName().equals(name)) {
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public static Service getService(JavaImplementation type, String name) {
+ for (Service svc : type.getServices()) {
+ if (svc.getName().equals(name)) {
+ return svc;
+ }
+ }
+ return null;
+ }
+
+ public static boolean matches(Contract contract, Class<?> type) {
+ Interface interface1 = contract.getInterfaceContract().getInterface();
+ if (interface1 instanceof JavaInterface) {
+ return type == ((JavaInterface)interface1).getJavaClass();
+ } else {
+ return false;
+ }
+ }
+
+ public static ComponentService createService(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, Class<?> type) {
+ org.apache.tuscany.sca.assembly.ComponentService ref = factory.createComponentService();
+ ref.setName(type.getSimpleName());
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+ public static Reference createReference(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, String name, Class<?> type) {
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName(name);
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java
new file mode 100644
index 0000000000..ba8da101c6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.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.implementation.java.context;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Tests wires that are configured with a multiplicity
+ *
+ * @version $Rev$ $Date$
+ */
+public class MultiplicityTestCase extends TestCase {
+
+ public void testMultiplicity() throws Exception {
+ // TODO implement
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java
new file mode 100644
index 0000000000..c098062bc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.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.implementation.java.context;
+
+import static org.easymock.EasyMock.createMock;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.injection.EventInvoker;
+import org.apache.tuscany.sca.scope.TargetDestructionException;
+import org.apache.tuscany.sca.scope.TargetInitializationException;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReflectiveInstanceWrapperTestCase extends TestCase {
+ private ReflectiveInstanceWrapper<Object> wrapper;
+ private Object instance;
+ private EventInvoker<Object> initInvoker;
+ private EventInvoker<Object> destroyInvoker;
+
+ public void testWithNoCallbacks() {
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, null);
+ try {
+ wrapper.start();
+ } catch (TargetInitializationException e) {
+ fail();
+ }
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ fail();
+ }
+ }
+
+ public void testWithStartCallback() {
+ initInvoker.invokeEvent(instance);
+ EasyMock.replay(initInvoker);
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, initInvoker, null);
+ try {
+ wrapper.start();
+ } catch (TargetInitializationException e) {
+ fail();
+ }
+ EasyMock.verify(initInvoker);
+ }
+
+ public void testWithStopCallback() {
+ destroyInvoker.invokeEvent(instance);
+ EasyMock.replay(destroyInvoker);
+ wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, destroyInvoker);
+ try {
+ wrapper.stop();
+ } catch (TargetDestructionException e) {
+ fail();
+ }
+ EasyMock.verify(destroyInvoker);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ instance = new Object();
+ initInvoker = createMock(EventInvoker.class);
+ destroyInvoker = createMock(EventInvoker.class);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java
new file mode 100644
index 0000000000..29dcfa8169
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.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.implementation.java.injection;
+
+import static org.easymock.EasyMock.createMock;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CallbackWireObjectFactoryTestCase extends TestCase {
+
+ @SuppressWarnings({"unchecked"})
+ public void testCreateInstance() throws Exception {
+ ProxyFactory service = createMock(ProxyFactory.class);
+ Foo foo = new Foo() {
+ };
+ EasyMock.expect(service.createCallbackProxy(EasyMock.eq(Foo.class), EasyMock.isA(List.class))).andReturn(foo);
+ EasyMock.replay(service);
+ List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
+ CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, wires);
+ assertEquals(foo, factory.getInstance());
+ EasyMock.verify(service);
+ }
+
+ private interface Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java
new file mode 100644
index 0000000000..cef5cd4788
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Field;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FieldInjectorTestCase extends TestCase {
+
+ protected Field protectedField;
+
+ public void testIllegalAccess() throws Exception {
+ FieldInjector<Foo> injector = new FieldInjector<Foo>(protectedField, new SingletonObjectFactory<String>("foo"));
+ Foo foo = new Foo();
+ injector.inject(foo);
+ assertEquals("foo", foo.hidden);
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ protectedField = Foo.class.getDeclaredField("hidden");
+ }
+
+ private class Foo {
+ private String hidden;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactoryTestCase.java
new file mode 100644
index 0000000000..69d2696944
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JNDIObjectFactoryTestCase.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.implementation.java.injection;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JNDIObjectFactoryTestCase extends TestCase {
+
+ public void testGetInstance() throws Exception {
+ Context ctx = EasyMock.createMock(Context.class);
+ EasyMock.expect(ctx.lookup(EasyMock.eq("foo"))).andReturn(new Foo());
+ EasyMock.replay(ctx);
+ JNDIObjectFactory<Foo> factory = new JNDIObjectFactory<Foo>(ctx, "foo");
+ assertTrue(factory.getInstance() instanceof Foo); // must do an instanceof b/c of type erasure
+ EasyMock.verify(ctx);
+ }
+
+ public void testGetInstanceError() throws Exception {
+ Context ctx = EasyMock.createMock(Context.class);
+ EasyMock.expect(ctx.lookup(EasyMock.eq("foo"))).andThrow(new NamingException());
+ EasyMock.replay(ctx);
+ JNDIObjectFactory<Foo> factory = new JNDIObjectFactory<Foo>(ctx, "foo");
+ try {
+ factory.getInstance();
+ fail();
+ } catch (ObjectCreationException e) {
+ //expected
+ }
+ EasyMock.verify(ctx);
+ }
+
+
+ private class Foo {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java
new file mode 100644
index 0000000000..47fb224c1e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MethodEventInvokerTestCase extends TestCase {
+ private Method privateMethod;
+ private Method exceptionMethod;
+
+ public void testIllegalAccess() throws Exception {
+ MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(privateMethod);
+ try {
+ injector.invokeEvent(new Foo());
+ fail();
+ } catch (AssertionError e) {
+ // expected
+ }
+ }
+
+ public void testException() throws Exception {
+ MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(exceptionMethod);
+ try {
+ injector.invokeEvent(new Foo());
+ fail();
+ } catch (RuntimeException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ privateMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("hidden");
+ exceptionMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("exception");
+
+ }
+
+ private class Foo {
+
+ public void foo() {
+ }
+
+ private void hidden() {
+ }
+
+ public void exception() {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java
new file mode 100644
index 0000000000..f2b8b97e5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class MethodInjectorTestCase extends TestCase {
+ private Method fooMethod;
+ private Method privateMethod;
+ private Method exceptionMethod;
+
+ public void testIllegalArgument() throws Exception {
+ ObjectFactory<Object> factory = new SingletonObjectFactory<Object>(new Object());
+ MethodInjector<Foo> injector = new MethodInjector<Foo>(fooMethod, factory);
+ try {
+ injector.inject(new Foo());
+ fail();
+ } catch (ObjectCreationException e) {
+ // expected
+ }
+ }
+
+ public void testException() throws Exception {
+ ObjectFactory<Object> factory = new SingletonObjectFactory<Object>("foo");
+ MethodInjector<Foo> injector = new MethodInjector<Foo>(exceptionMethod, factory);
+ try {
+ injector.inject(new Foo());
+ fail();
+ } catch (RuntimeException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ fooMethod = Foo.class.getMethod("foo", String.class);
+ privateMethod = Foo.class.getDeclaredMethod("hidden", String.class);
+ exceptionMethod = Foo.class.getDeclaredMethod("exception", String.class);
+
+ }
+
+ private class Foo {
+
+ public void foo(String bar) {
+ }
+
+ private void hidden(String bar) {
+ }
+
+ public void exception(String bar) {
+ throw new RuntimeException();
+ }
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactoryTestCase.java
new file mode 100644
index 0000000000..6bf0658284
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/PojoObjectFactoryTestCase.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.implementation.java.injection;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PojoObjectFactoryTestCase extends TestCase {
+
+ private Constructor<Foo> ctor;
+
+ public void testConstructorInjection() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(new SingletonObjectFactory<String>("foo"));
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ /**
+ * Verifies null parameters can be passed to a constructor. This is valid when a reference is optional during
+ * constructor injection
+ */
+ public void testConstructorInjectionOptionalParam() throws Exception {
+ List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
+ initializers.add(null);
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(ctor, initializers);
+ Foo foo = factory.getInstance();
+ assertNull(foo.foo);
+ }
+
+ public void testConstructorInitializerInjection() throws Exception {
+ PojoObjectFactory<Foo> factory = new PojoObjectFactory<Foo>(ctor);
+ factory.setInitializerFactory(0, new SingletonObjectFactory<String>("foo"));
+ Foo foo = factory.getInstance();
+ assertEquals("foo", foo.foo);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ ctor = Foo.class.getConstructor(String.class);
+ }
+
+ private static class Foo {
+
+ private String foo;
+
+ public Foo(String foo) {
+ this.foo = foo;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java
new file mode 100644
index 0000000000..d8b981e952
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.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.implementation.java.injection;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RequestContextObjectFactoryTestCase extends TestCase {
+
+ public void testInstanceCreate() {
+ RequestContextObjectFactory factory = new RequestContextObjectFactory();
+ assertNotNull(factory.getInstance());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java
new file mode 100644
index 0000000000..ed7a0e7d03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.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.implementation.java.injection;
+
+import junit.framework.TestCase;
+
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceObjectFactoryTestCase extends TestCase {
+
+ public void testResolveFromHostByType() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn("foo");
+ EasyMock.replay(host);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+ public void testResolveFromHostByName() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class),
+ EasyMock.eq("sca://localhost/bar"))).andReturn("foo");
+ EasyMock.replay(host);
+ ResourceObjectFactory<String> factory =
+ new ResourceObjectFactory<String>(String.class, "sca://localhost/bar", false, host);
+ assertEquals("foo", factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+
+ public void testResolveFromParentThenResolveFromHostNotFound() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(host);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
+ assertNull(factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+ public void testResolveByTypeNotFound() throws Exception {
+// ResourceHost host = EasyMock.createMock(ResourceHost.class);
+// EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+// EasyMock.replay(host);
+//
+// RuntimeWire wire = EasyMock.createMock(RuntimeWire.class);
+// EasyMock.expect(wire.getTargetInstance()).andReturn(null);
+// EasyMock.replay(wire);
+//
+// ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
+// try {
+// factory.getInstance();
+// fail();
+// } catch (ResourceNotFoundException e) {
+// //expected
+// }
+// EasyMock.verify(host);
+ }
+
+ public void testResolveByTypeNotFoundOptional() throws Exception {
+ ResourceHost host = EasyMock.createMock(ResourceHost.class);
+ EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
+ EasyMock.replay(host);
+ ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
+ assertNull(factory.getInstance());
+ EasyMock.verify(host);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java
new file mode 100644
index 0000000000..40ad1b1e95
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.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.implementation.java.injection;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SingletonObjectFactoryTestCase extends TestCase {
+
+ public void testSingleton() throws Exception {
+ Object o = new Object();
+ SingletonObjectFactory<Object> factory = new SingletonObjectFactory<Object>(o);
+ assertEquals(o, factory.getInstance());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/AbstractConversationTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/AbstractConversationTestCase.java
new file mode 100644
index 0000000000..738775b9a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/AbstractConversationTestCase.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.implementation.java.integration;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.core.scope.ConversationalScopeContainer;
+import org.apache.tuscany.sca.core.store.MemoryStore;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.scope.ScopeContainer;
+import org.apache.tuscany.sca.store.StoreMonitor;
+import org.easymock.EasyMock;
+
+/**
+ * Provides helper methods for setting up a partial runtime for conversational test cases.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractConversationTestCase extends TestCase {
+ protected ScopeContainer container;
+ protected MemoryStore store;
+ protected RuntimeComponent component;
+
+ protected void createRuntime() {
+ store = new MemoryStore(EasyMock.createNiceMock(StoreMonitor.class));
+ component = EasyMock.createMock(RuntimeComponent.class);
+ container = new ConversationalScopeContainer(store, component);
+ }
+
+ protected void initializeRuntime() {
+ store.init();
+ container.start();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationIdleExpireTestCase.java.FIXME b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationIdleExpireTestCase.java.FIXME
new file mode 100644
index 0000000000..47fa0f0bc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationIdleExpireTestCase.java.FIXME
@@ -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.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.component.TargetNotFoundException;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum idle time is exceeded
+ *
+ * @version $Rev: 526852 $ $Date: 2007-04-09 10:47:45 -0700 (Mon, 09 Apr 2007) $
+ */
+public abstract class ConversationIdleExpireTestCase extends AbstractConversationTestCase {
+ protected AtomicComponent target;
+ private JDKInvocationHandler handler;
+ private FooImpl targetInstance;
+ private Method operation1;
+ private Method operation2;
+ private final Object mutex = new Object();
+
+ public void testConversationExpire() throws Throwable {
+ workContext.setIdentifier(Scope.CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+ synchronized (mutex) {
+ mutex.wait(100);
+ }
+ // verify the instance was expired
+ assertNull(store.readRecord(target, "12345A"));
+ // continue the conversation - should throw an error
+ try {
+ handler.invoke(operation2, null);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ store.setReaperInterval(10);
+ initializeRuntime();
+
+ targetInstance = EasyMock.createMock(FooImpl.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ target = createTarget();
+
+ Wire wire = MockFactory.createWire("foo", Foo.class);
+ for (InvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(target.createTargetInvoker("target", chain.getOperation(), false));
+ }
+ handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private JavaAtomicComponent createTarget() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName(new URI("target"));
+ configuration.setMaxIdleTime(50);
+ configuration.setInstanceFactory(new MockPojoFactory(FooImpl.class.getConstructor()));
+ configuration.setImplementationClass(FooImpl.class);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+ public MockPojoFactory(Constructor<FooImpl> ctr) {
+ super(ctr);
+ }
+
+ public FooImpl getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Conversational
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+ public static class FooImpl implements Foo {
+
+ public void operation1() {
+ }
+
+ public void operation2() {
+ }
+
+ @EndsConversation
+ public void end() {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationMaxAgeExpireTestCase.java.FIXME b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationMaxAgeExpireTestCase.java.FIXME
new file mode 100644
index 0000000000..36e221a1e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationMaxAgeExpireTestCase.java.FIXME
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies conversational resources are cleaned up if the maximum age is exceeded
+ *
+ * @version $Rev: 526852 $ $Date: 2007-04-09 10:47:45 -0700 (Mon, 09 Apr 2007) $
+ */
+public abstract class ConversationMaxAgeExpireTestCase extends AbstractConversationTestCase {
+ protected AtomicComponent target;
+ private JDKInvocationHandler handler;
+ private FooImpl targetInstance;
+ private Method operation1;
+ private Method operation2;
+ private final Object mutex = new Object();
+
+ public void testConversationExpire() throws Throwable {
+/*
+ workContext.setIdentifier(org.apache.tuscany.spi.model.Scope.CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+ synchronized (mutex) {
+ mutex.wait(100);
+ }
+ // verify the instance was expired
+ assertNull(store.readRecord(target, "12345A"));
+ // continue the conversation - should throw an error
+ try {
+ handler.invoke(operation2, null);
+ fail();
+ } catch (TargetNotFoundException e) {
+ // expected
+ }
+*/
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ store.setReaperInterval(10);
+ initializeRuntime();
+
+ targetInstance = EasyMock.createMock(FooImpl.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ target = createTarget();
+ // create source component mock
+ JavaAtomicComponent source = EasyMock.createMock(JavaAtomicComponent.class);
+ EasyMock.expect(source.getUri()).andReturn(URI.create("source")).atLeastOnce();
+ EasyMock.replay(source);
+
+ Wire wire = MockFactory.createWire("foo", Foo.class);
+ for (InvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(target.createTargetInvoker("target", chain.getOperation(), false));
+ }
+ handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private AtomicComponent createTarget() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName(new URI("target"));
+ configuration.setMaxAge(50);
+ Constructor<FooImpl> ctor = FooImpl.class.getConstructor();
+ configuration.setInstanceFactory(new MockPojoFactory(ctor));
+ configuration.setImplementationClass(FooImpl.class);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+ public MockPojoFactory(Constructor<FooImpl> ctr) {
+ super(ctr);
+ }
+
+ public FooImpl getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Conversational
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+ public static class FooImpl implements Foo {
+
+ public void operation1() {
+ }
+
+ public void operation2() {
+ }
+
+ @EndsConversation
+ public void end() {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationStartStopEndTestCase.java.FIXME b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationStartStopEndTestCase.java.FIXME
new file mode 100644
index 0000000000..1872eea709
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ConversationStartStopEndTestCase.java.FIXME
@@ -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.core.integration.conversation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.URI;
+
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.wire.jdk.JDKInvocationHandler;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.Scope;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.InstanceWrapper;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.Wire;
+import org.easymock.EasyMock;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * Verifies start, continue and end conversation invocations are processed properly. Checks that a target instance is
+ * properly instantiated and persisted in the store. Additionally verifies that invocations are dispatched to a target
+ * instance, and that start, continue, and end operations are performed correctly. Finally, verfies that the target
+ * instance is removed from the store when the conversation ends.
+ *
+ * @version $Rev: 526852 $ $Date: 2007-04-09 10:47:45 -0700 (Mon, 09 Apr 2007) $
+ */
+public abstract class ConversationStartStopEndTestCase extends AbstractConversationTestCase {
+ protected AtomicComponent target;
+ private FooImpl targetInstance;
+ private JDKInvocationHandler handler;
+ private Method operation1;
+ private Method operation2;
+ private Method endOperation;
+
+ public void testConversationStartContinueEnd() throws Throwable {
+ workContext.setIdentifier(Scope.CONVERSATION, "12345A");
+ // start the conversation
+ handler.invoke(operation1, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+ // continue the conversation
+ handler.invoke(operation2, null);
+ // verify the instance was persisted
+ assertEquals(targetInstance, ((InstanceWrapper)store.readRecord(target, "12345A")).getInstance());
+ // end the conversation
+ handler.invoke(endOperation, null);
+ workContext.clearIdentifier(Scope.CONVERSATION);
+ EasyMock.verify(targetInstance);
+ // verify the store has removed the instance
+ assertNull(store.readRecord(target, "12345A"));
+ }
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ createRuntime();
+ initializeRuntime();
+ targetInstance = EasyMock.createMock(FooImpl.class);
+ targetInstance.operation1();
+ targetInstance.operation2();
+ targetInstance.end();
+ EasyMock.replay(targetInstance);
+ // create target component mock
+ target = createAtomicComponent();
+ Wire wire = MockFactory.createWire("foo", Foo.class);
+ for (InvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(target.createTargetInvoker("foo", chain.getOperation(), false));
+ }
+ handler = new JDKInvocationHandler(Foo.class, wire, workContext);
+ operation1 = Foo.class.getMethod("operation1");
+ operation2 = Foo.class.getMethod("operation2");
+ endOperation = Foo.class.getMethod("end");
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ container.stop();
+ store.destroy();
+ }
+
+ private JavaAtomicComponent createAtomicComponent() throws Exception {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setName(new URI("target"));
+ configuration.setInstanceFactory(new MockPojoFactory(FooImpl.class.getConstructor()));
+ configuration.setImplementationClass(FooImpl.class);
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(container);
+ component.start();
+ return component;
+ }
+
+ private class MockPojoFactory extends PojoObjectFactory<FooImpl> {
+ public MockPojoFactory(Constructor<FooImpl> ctr) {
+ super(ctr);
+ }
+
+ public FooImpl getInstance() throws ObjectCreationException {
+ return targetInstance;
+ }
+ }
+
+ @Conversational
+ public static interface Foo {
+
+ void operation1();
+
+ void operation2();
+
+ @EndsConversation
+ void end();
+
+ }
+
+ public static class FooImpl implements Foo {
+
+ public void operation1() {
+ }
+
+ public void operation2() {
+ }
+
+ @EndsConversation
+ public void end() {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ReferenceInjectionTestCase.java.FIXME b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ReferenceInjectionTestCase.java.FIXME
new file mode 100644
index 0000000000..17a832b117
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/integration/ReferenceInjectionTestCase.java.FIXME
@@ -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.core.integration.wire;
+
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+import java.util.Map;
+import java.net.URI;
+
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.component.scope.CompositeScopeContainer;
+import org.apache.tuscany.core.integration.mock.MockFactory;
+import org.apache.tuscany.core.mock.component.Source;
+import org.apache.tuscany.core.mock.component.SourceImpl;
+import org.apache.tuscany.core.mock.component.Target;
+import org.apache.tuscany.core.mock.component.TargetImpl;
+
+/**
+ * @version $$Rev: 526399 $$ $$Date: 2007-04-07 01:14:49 -0700 (Sat, 07 Apr 2007) $$
+ */
+public class ReferenceInjectionTestCase extends TestCase {
+ private Map<String, Member> members;
+
+ public void testProxiedReferenceInjection() throws Exception {
+ ScopeContainer scope = new CompositeScopeContainer(null);
+ scope.start();
+ URI groupId = URI.create("composite");
+ scope.startContext(groupId, groupId);
+ Map<String, AtomicComponent> components = MockFactory.createWiredComponents("source",
+ SourceImpl.class,
+ scope,
+ members,
+ "target",
+ Target.class,
+ TargetImpl.class,
+ scope);
+ AtomicComponent sourceComponent = components.get("source");
+ Source source = (Source) sourceComponent.getTargetInstance();
+ Target target = source.getTarget();
+ assertTrue(Proxy.isProxyClass(target.getClass()));
+
+ assertNotNull(target);
+ scope.stop();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ members = new HashMap<String, Member>();
+ Method m = SourceImpl.class.getMethod("setTarget", Target.class);
+ members.put("target", m);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/AsyncTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/AsyncTarget.java
new file mode 100644
index 0000000000..65681550c0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/AsyncTarget.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface AsyncTarget {
+ @OneWay
+ void invoke();
+
+ int getCount();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadContextPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadContextPojo.java
new file mode 100644
index 0000000000..319d965960
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadContextPojo.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Context;
+
+public class BadContextPojo {
+
+ @Context
+ String context;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadNamePojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadNamePojo.java
new file mode 100644
index 0000000000..1a93254f2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BadNamePojo.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.ComponentName;
+
+public class BadNamePojo {
+ @ComponentName
+ private int name;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterface.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterface.java
new file mode 100644
index 0000000000..716a70b007
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterface.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.implementation.java.mock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface BasicInterface {
+ String returnsProperty();
+
+ BasicInterface returnsReference();
+
+ int returnsInt();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterfaceImpl.java
new file mode 100644
index 0000000000..5f3dc8e5fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/BasicInterfaceImpl.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.sca.implementation.java.mock;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BasicInterfaceImpl implements BasicInterface {
+
+ @Property
+ public String publicProperty;
+
+ @Reference (required = false)
+ public BasicInterface publicReference;
+
+ @Property
+ protected String protectedProperty;
+
+ @Reference (required = false)
+ protected BasicInterface protectedReference;
+
+ private String privateProperty;
+
+ private BasicInterface privateReference;
+
+ @Property
+ public void setPrivateProperty(String privateProperty) {
+ this.privateProperty = privateProperty;
+ }
+
+ @Reference (required = false)
+ public void setPrivateReference(BasicInterface privateReference) {
+ this.privateReference = privateReference;
+ }
+
+ public String returnsProperty() {
+ return privateProperty;
+ }
+
+ public BasicInterface returnsReference() {
+ return privateReference;
+ }
+
+ public int returnsInt() {
+ return 0;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponent.java
new file mode 100644
index 0000000000..1014dd3e1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public interface CompositeScopeComponent {
+
+ //public boolean isInit();
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponentImpl.java
new file mode 100644
index 0000000000..2b654111f3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeComponentImpl.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+public class CompositeScopeComponentImpl implements
+ CompositeScopeComponent {
+
+ private String foo;
+
+ public void setFoo(String foo) {
+ this.foo = foo;
+ }
+
+ public String getFoo() {
+ return foo;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..7c5751578a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeDestroyOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeDestroyOnlyComponent extends CompositeScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..4e08b7157b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitDestroyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class CompositeScopeInitDestroyComponent extends CompositeScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ if (destroyed) {
+ throw new AssertionError("Destroy called more than once");
+ }
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..a9c8bf1566
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/CompositeScopeInitOnlyComponent.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.sca.implementation.java.mock;
+
+import org.osoa.sca.annotations.Init;
+
+public class CompositeScopeInitOnlyComponent extends CompositeScopeComponentImpl {
+
+ private boolean initialized;
+ // this value tests to ensure introspection can find the init() method even
+ // if a field is named the same. Ultimately, this should be in the introspection tests
+ private boolean init;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ if (initialized) {
+ throw new AssertionError("Init called more than once");
+ }
+ initialized = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponent.java
new file mode 100644
index 0000000000..39e8c4ca11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public interface ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponentImpl.java
new file mode 100644
index 0000000000..caf5b292f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeComponentImpl.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev: 430937 $ $Date: 2006-08-11 21:17:56 -0400 (Fri, 11 Aug 2006) $
+ */
+@Scope("CONVERSATION")
+public class ConversationalScopeComponentImpl implements ConversationalScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..9fe019010d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeDestroyOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeDestroyOnlyComponent extends ConversationalScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..77f9855fe0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitDestroyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitDestroyComponent
+ extends ConversationalScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..d45d1a3def
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/ConversationalScopeInitOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+public class ConversationalScopeInitOnlyComponent
+ extends ConversationalScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockFactory.java.FIXME b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockFactory.java.FIXME
new file mode 100644
index 0000000000..56bccd8f09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockFactory.java.FIXME
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.integration.mock;
+
+import java.lang.reflect.Member;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.assembly.Contract;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.core.component.WorkContextImpl;
+import org.apache.tuscany.core.implementation.PojoConfiguration;
+import org.apache.tuscany.core.implementation.java.JavaAtomicComponent;
+import org.apache.tuscany.core.injection.PojoObjectFactory;
+import org.apache.tuscany.core.wire.InvocationChainImpl;
+import org.apache.tuscany.core.wire.InvokerInterceptor;
+import org.apache.tuscany.core.wire.WireImpl;
+import org.apache.tuscany.core.wire.jdk.JDKProxyService;
+import org.apache.tuscany.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.java.introspection.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.interfacedef.java.introspection.impl.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.spi.component.AtomicComponent;
+import org.apache.tuscany.spi.component.ScopeContainer;
+import org.apache.tuscany.spi.wire.Interceptor;
+import org.apache.tuscany.spi.wire.InvocationChain;
+import org.apache.tuscany.spi.wire.ProxyService;
+import org.apache.tuscany.spi.wire.Wire;
+
+/**
+ * @version $$Rev: 526852 $$ $$Date: 2007-04-09 10:47:45 -0700 (Mon, 09 Apr 2007) $$
+ */
+public final class MockFactory {
+
+ private static final ProxyService PROXY_SERVICE = new JDKProxyService(new WorkContextImpl());
+ private static final JavaInterfaceProcessorRegistry REGISTRY = new JavaInterfaceProcessorRegistryImpl();
+
+ private MockFactory() {
+ }
+
+ /**
+ * Wires two components together where the reference interface is the same as target service
+ */
+ public static Map<String, AtomicComponent> createWiredComponents(String sourceName,
+ Class<?> sourceClass,
+ ScopeContainer sourceScope,
+ Map<String, Member> members,
+ String targetName,
+ Class<?> targetService,
+ Class<?> targetClass,
+ ScopeContainer targetScope) throws Exception {
+ return createWiredComponents(sourceName,
+ sourceClass,
+ targetService,
+ sourceScope,
+ null,
+ members,
+ targetName,
+ targetClass,
+ targetScope
+ );
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Map<String, AtomicComponent> createWiredComponents(String sourceName, Class<?> sourceClass,
+ Class<?> sourceReferenceClass,
+ ScopeContainer sourceScope,
+ Interceptor sourceHeadInterceptor,
+ Map<String, Member> members,
+ String targetName,
+ Class<?> targetClass,
+ ScopeContainer targetScope
+ )
+ throws Exception {
+
+ JavaAtomicComponent targetComponent =
+ createJavaComponent(targetName, targetScope, targetClass);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
+ configuration.setProxyService(PROXY_SERVICE);
+ for (Map.Entry<String, Member> entry : members.entrySet()) {
+ configuration.addReferenceSite(entry.getKey(), entry.getValue());
+ }
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(new URI(sourceName));
+ configuration.setGroupId(URI.create("composite"));
+ JavaAtomicComponent sourceComponent = new JavaAtomicComponent(configuration);
+ sourceComponent.setScopeContainer(sourceScope);
+ Wire wire = createWire(targetName, sourceReferenceClass, sourceHeadInterceptor);
+ for (InvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(targetComponent.createTargetInvoker(targetName, chain.getOperation(), false));
+ }
+ sourceComponent.attachWire(wire);
+ targetScope.register(targetComponent, configuration.getGroupId());
+ sourceScope.register(sourceComponent, configuration.getGroupId());
+ Map<String, AtomicComponent> components = new HashMap<String, AtomicComponent>();
+ components.put(sourceName, sourceComponent);
+ components.put(targetName, targetComponent);
+ return components;
+ }
+
+
+ /**
+ * Wires two components using a multiplicity reference
+ */
+ @SuppressWarnings("unchecked")
+ public static Map<String, AtomicComponent> createWiredMultiplicity(String sourceName, Class<?> sourceClass,
+ Class<?> sourceReferenceClass,
+ ScopeContainer sourceScope,
+ String targetName, Class<?> targetService,
+ Class<?> targetClass,
+ Map<String, Member> members,
+ ScopeContainer targetScope) throws Exception {
+ JavaAtomicComponent targetComponent =
+ createJavaComponent(targetName, targetScope, targetClass);
+ String serviceName = targetService.getName().substring(targetService.getName().lastIndexOf('.') + 1);
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setInstanceFactory(new PojoObjectFactory(sourceClass.getConstructor()));
+ configuration.setProxyService(PROXY_SERVICE);
+ for (Map.Entry<String, Member> entry : members.entrySet()) {
+ configuration.addReferenceSite(entry.getKey(), entry.getValue());
+ }
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(new URI(sourceName));
+ configuration.setGroupId(URI.create("composite"));
+
+ JavaAtomicComponent sourceComponent = new JavaAtomicComponent(configuration);
+ sourceComponent.setScopeContainer(sourceScope);
+ Wire wire = createWire(targetName, sourceReferenceClass, null);
+ wire.setTargetUri(URI.create(targetName + "#" + serviceName));
+ for (InvocationChain chain : wire.getInvocationChains().values()) {
+ chain.setTargetInvoker(targetComponent.createTargetInvoker("target", chain.getOperation(), false));
+ }
+ List<Wire> wires = new ArrayList<Wire>();
+ wires.add(wire);
+ sourceComponent.attachWires(wires);
+ targetScope.register(targetComponent, configuration.getGroupId());
+ sourceScope.register(sourceComponent, configuration.getGroupId());
+
+ Map<String, AtomicComponent> components = new HashMap<String, AtomicComponent>();
+ components.put(sourceName, sourceComponent);
+ components.put(targetName, targetComponent);
+ return components;
+ }
+
+ public static <T> Wire createWire(String serviceName, Class<T> interfaze)
+ throws InvalidInterfaceException {
+ return createWire(serviceName, interfaze, null);
+ }
+
+ public static <T> Wire createWire(String serviceName, Class<T> interfaze, Interceptor interceptor)
+ throws InvalidInterfaceException {
+ Wire wire = new WireImpl();
+ Contract contract = new DefaultAssemblyFactory().createComponentService();
+ REGISTRY.introspect(contract, interfaze);
+ wire.setSourceContract(contract);
+ wire.setSourceUri(URI.create("#" + serviceName));
+ createChains(interfaze, interceptor, wire);
+ return wire;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> JavaAtomicComponent createJavaComponent(String name, ScopeContainer scope, Class<T> clazz)
+ throws NoSuchMethodException, URISyntaxException {
+ PojoConfiguration configuration = new PojoConfiguration();
+ configuration.setImplementationClass(clazz);
+ configuration.setInstanceFactory(new PojoObjectFactory(clazz.getConstructor()));
+ configuration.setProxyService(PROXY_SERVICE);
+ configuration.setWorkContext(new WorkContextImpl());
+ configuration.setName(new URI(name));
+ configuration.setGroupId(URI.create("composite"));
+ JavaAtomicComponent component = new JavaAtomicComponent(configuration);
+ component.setScopeContainer(scope);
+ return component;
+ }
+
+ private static void createChains(Class<?> interfaze, Interceptor interceptor, Wire wire)
+ throws InvalidInterfaceException {
+
+ Contract contract = new DefaultAssemblyFactory().createComponentService();
+ REGISTRY.introspect(contract, interfaze);
+ for (Operation method : contract.getInterface().getOperations()) {
+ InvocationChain chain = new InvocationChainImpl(method);
+ if (interceptor != null) {
+ chain.addInterceptor(interceptor);
+ }
+ // add tail interceptor
+ chain.addInterceptor(new InvokerInterceptor());
+ wire.addInvocationChain(method, chain);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockStaticInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockStaticInvoker.java
new file mode 100644
index 0000000000..23822bec74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockStaticInvoker.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.mock;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.implementation.java.invocation.TargetInvoker;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Message;
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * Caches component instances that do not need to be resolved for every wire, e.g. an wire originating from a lesser
+ * scope intended for a target with a wider scope
+ *
+ * @version $Rev$ $Date$
+ */
+public class MockStaticInvoker implements TargetInvoker {
+
+ private Object instance;
+ private Method operation;
+ private boolean cacheable;
+
+
+ public MockStaticInvoker(Method operation, Object instance) {
+ this.operation = operation;
+ this.instance = instance;
+ }
+
+ public boolean isCacheable() {
+ return cacheable;
+ }
+
+ public void setCacheable(boolean cacheable) {
+ this.cacheable = cacheable;
+ }
+
+ public Object invokeTarget(final Object payload, final ConversationSequence sequence) throws InvocationTargetException {
+ try {
+ if (payload != null && !payload.getClass().isArray()) {
+ return operation.invoke(instance, payload);
+ } else {
+ return operation.invoke(instance, (Object[]) payload);
+ }
+ } catch (IllegalAccessException e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = invokeTarget(msg.getBody(), null);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+ public void setNext(Interceptor next) {
+ throw new IllegalStateException("This interceptor must be the last interceptor in an interceptor chain");
+ }
+
+ public Object clone() throws CloneNotSupportedException {
+ try {
+ MockStaticInvoker invoker = (MockStaticInvoker) super.clone();
+ invoker.instance = this.instance;
+ invoker.operation = this.operation;
+ return invoker;
+ } catch (CloneNotSupportedException e) {
+ return null; // will not happen
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockSyncInterceptor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockSyncInterceptor.java
new file mode 100644
index 0000000000..1e2f89cdf6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/MockSyncInterceptor.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.implementation.java.mock;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+public class MockSyncInterceptor implements Interceptor {
+
+ private int count;
+
+ private Invoker next;
+
+ public MockSyncInterceptor() {
+ }
+
+ public Message invoke(Message msg) {
+ ++count;
+ return next.invoke(msg);
+ }
+
+ public int getCount() {
+ return count;
+ }
+
+ public void setNext(Invoker next) {
+ this.next = next;
+ }
+
+ public Invoker getNext() {
+ return next;
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderException.java
new file mode 100644
index 0000000000..1d337de93f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderException.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.implementation.java.mock;
+
+public class OrderException extends Exception {
+
+ public OrderException() {
+ super();
+ }
+
+ public OrderException(String message) {
+ super(message);
+ }
+
+ public OrderException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public OrderException(Throwable cause) {
+ super(cause);
+ }
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojo.java
new file mode 100644
index 0000000000..09b58497fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojo.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.implementation.java.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedDependentPojo extends OrderedInitPojo {
+
+ OrderedInitPojo getPojo();
+
+ void setPojo(OrderedInitPojo pojo);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojoImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojoImpl.java
new file mode 100644
index 0000000000..0fc5a88925
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedDependentPojoImpl.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.implementation.java.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public class OrderedDependentPojoImpl extends OrderedInitPojoImpl implements OrderedDependentPojo {
+
+ private OrderedInitPojo pojo;
+
+ public OrderedInitPojo getPojo() {
+ return pojo;
+ }
+
+ public void setPojo(OrderedInitPojo pojo) {
+ this.pojo = pojo;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedEagerInitPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedEagerInitPojo.java
new file mode 100644
index 0000000000..0907bf3e8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedEagerInitPojo.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+@EagerInit
+public class OrderedEagerInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojo.java
new file mode 100644
index 0000000000..0c4f65e904
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojo.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.implementation.java.mock;
+
+/**
+ * @version $$Rev$$ $$Date$$
+ */
+public interface OrderedInitPojo {
+ int getNumberInstantiated();
+
+ int getInitOrder();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojoImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojoImpl.java
new file mode 100644
index 0000000000..e67a1b807b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OrderedInitPojoImpl.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class OrderedInitPojoImpl implements OrderedInitPojo {
+
+ private static final Object LOCK = new Object();
+ private static int numberInstantied;
+ private int initOrder;
+
+ public OrderedInitPojoImpl() {
+ }
+
+ @Init
+ public void init() {
+ synchronized (LOCK) {
+ ++numberInstantied;
+ initOrder = numberInstantied;
+ }
+ }
+
+ @Destroy
+ public void destroy() throws OrderException {
+ synchronized (LOCK) {
+ if (initOrder != numberInstantied) {
+ throw new OrderException("Instance shutdown done out of order");
+ }
+ --numberInstantied;
+ }
+ }
+
+ public int getNumberInstantiated() {
+ return numberInstantied;
+ }
+
+ public int getInitOrder() {
+ return initOrder;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTarget.java
new file mode 100644
index 0000000000..61802beaea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTarget.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.implementation.java.mock;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface OtherTarget {
+
+ String getString();
+
+ void setString(String val);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTargetImpl.java
new file mode 100644
index 0000000000..3b8c4842f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/OtherTargetImpl.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.implementation.java.mock;
+
+/**
+ * A target used for testing wires with a different source and target interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class OtherTargetImpl implements OtherTarget {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeComponent.java
new file mode 100644
index 0000000000..b10b1e7648
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("REQUEST")
+public interface RequestScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeDestroyOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeDestroyOnlyComponent.java
new file mode 100644
index 0000000000..f504e284ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeDestroyOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeDestroyOnlyComponent extends SessionScopeComponentImpl {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..5a0f15a54f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitDestroyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..b72cf2f1a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/RequestScopeInitOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Init;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("REQUEST")
+public class RequestScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponent.java
new file mode 100644
index 0000000000..7dcfd4acda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public interface SessionScopeComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponentImpl.java
new file mode 100644
index 0000000000..bb0da51475
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeComponentImpl.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("SESSION")
+public class SessionScopeComponentImpl implements
+ SessionScopeComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitDestroyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitDestroyComponent.java
new file mode 100644
index 0000000000..5dc7d82a8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitDestroyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Destroy;
+
+public class SessionScopeInitDestroyComponent extends SessionScopeInitOnlyComponent {
+
+ private boolean destroyed;
+
+ public boolean isDestroyed() {
+ return destroyed;
+ }
+
+ @Destroy
+ public void destroy() {
+ destroyed = true;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitOnlyComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitOnlyComponent.java
new file mode 100644
index 0000000000..9a212c927f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SessionScopeInitOnlyComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Init;
+
+public class SessionScopeInitOnlyComponent extends SessionScopeComponentImpl {
+
+ private boolean initialized;
+
+ public boolean isInitialized() {
+ return initialized;
+ }
+
+ @Init
+ public void init() {
+ initialized = true;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTarget.java
new file mode 100644
index 0000000000..d8b6be1de0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTarget.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.implementation.java.mock;
+
+public interface SimpleTarget {
+
+ String hello(String message) throws Exception;
+
+ String goodbye(String message) throws Exception;
+
+ String echo(String message) throws Exception;
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTargetImpl.java
new file mode 100644
index 0000000000..27cb9a7617
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SimpleTargetImpl.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.sca.implementation.java.mock;
+
+public class SimpleTargetImpl implements SimpleTarget {
+
+ public SimpleTargetImpl() {
+ super();
+ }
+
+ public String hello(String message) throws Exception {
+ return message;
+ }
+
+ public String goodbye(String message) throws Exception {
+ return message;
+ }
+
+ public String echo(String message) throws Exception {
+ return message;
+ }
+
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Source.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Source.java
new file mode 100644
index 0000000000..630809bcad
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Source.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.implementation.java.mock;
+
+import java.util.List;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Source {
+
+ Target getTarget();
+
+ List<Target> getTargets();
+
+ List<Target> getTargetsThroughField();
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SourceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SourceImpl.java
new file mode 100644
index 0000000000..bd1abf6577
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/SourceImpl.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.implementation.java.mock;
+
+import java.util.List;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class SourceImpl implements Source {
+
+ private Target target;
+ private List<Target> targets;
+ private List<Target> targetsThroughField;
+ private Target[] targetsArray;
+
+ public void setTarget(Target target) {
+ this.target = target;
+ }
+
+ public Target getTarget() {
+ return target;
+ }
+
+ public List<Target> getTargets() {
+ return targets;
+ }
+
+ public void setTargets(List<Target> targets) {
+ this.targets = targets;
+ }
+
+ public List<Target> getTargetsThroughField() {
+ return targetsThroughField;
+ }
+
+ public Target[] getArrayOfTargets() {
+ return targetsArray;
+ }
+
+ public void setArrayOfTargets(Target[] targets) {
+ targetsArray = targets;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponent.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponent.java
new file mode 100644
index 0000000000..7eb9172f28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponent.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.implementation.java.mock;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@Scope("STATELESS")
+public interface StatelessComponent {
+
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponentImpl.java
new file mode 100644
index 0000000000..b1e0d33b63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/StatelessComponentImpl.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.implementation.java.mock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class StatelessComponentImpl implements
+ StatelessComponent {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Target.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Target.java
new file mode 100644
index 0000000000..fd175bdbc5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/Target.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.sca.implementation.java.mock;
+
+/**
+ * Implementations are used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Target {
+
+ String getString();
+
+ void setString(String val);
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/TargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/TargetImpl.java
new file mode 100644
index 0000000000..5f5a11028f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/mock/TargetImpl.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.implementation.java.mock;
+
+/**
+ * Mock system component implementation used in wiring tests
+ *
+ * @version $Rev$ $Date$
+ */
+public class TargetImpl implements Target {
+
+ private String theString;
+
+ public String getString() {
+ return theString;
+ }
+
+ public void setString(String val) {
+ theString = val;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterTestCase.java
new file mode 100644
index 0000000000..7598b4f968
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/ExceptionFormatterTestCase.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.implementation.java.monitor;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ExceptionFormatterTestCase extends TestCase {
+ private ExceptionFormatterImpl formatter = new ExceptionFormatterImpl();
+
+ public void testTuscanyExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ Exception e = new Exception("somemessage") {
+ };
+ formatter.write(pw, e);
+ assertTrue(writer.toString().indexOf("somemessage") >= 0);
+ }
+
+ public void testTuscanyRuntimeExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ RuntimeException e = new RuntimeException("somemessage") {
+ };
+ formatter.write(pw, e);
+ assertTrue(writer.toString().indexOf("somemessage") >= 0);
+ }
+
+ public void testNormalExceptionFormat() throws Exception {
+ StringWriter writer = new StringWriter();
+ PrintWriter pw = new PrintWriter(writer);
+ Exception e = new Exception();
+ formatter.write(pw, e); // just verify there are no errors since no formatting needs to be doen
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingTestCase.java
new file mode 100644
index 0000000000..2f7ed80030
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingTestCase.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.sca.implementation.java.monitor;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.api.annotation.LogLevel;
+
+/**
+ * Test case for the JavaLoggingMonitorFactory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaLoggingTestCase extends TestCase {
+ private static final Logger LOGGER = Logger.getLogger(Monitor.class.getName());
+ private static final MockHandler HANDLER = new MockHandler();
+
+ private MonitorFactory factory;
+
+ /**
+ * Smoke test to ensure the LOGGER is working.
+ */
+ public void testLogger() {
+ LOGGER.info("test");
+ assertEquals(1, HANDLER.logs.size());
+ }
+
+ /**
+ * Test that no record is logged.
+ */
+ public void testUnloggedEvent() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventNotToLog();
+ assertEquals(0, HANDLER.logs.size());
+ }
+
+ /**
+ * Test the correct record is written for an event with no arguments.
+ */
+ public void testEventWithNoArgs() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithNoArgs();
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Level.INFO, record.getLevel());
+ assertEquals(LOGGER.getName(), record.getLoggerName());
+ assertEquals(Monitor.class.getName() + "#eventWithNoArgs", record.getMessage());
+ }
+
+ /**
+ * Test the correct record is written for an event defined by annotation.
+ */
+ public void testEventWithAnnotation() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithAnnotation();
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Level.INFO, record.getLevel());
+ assertEquals(LOGGER.getName(), record.getLoggerName());
+ assertEquals(Monitor.class.getName() + "#eventWithAnnotation", record.getMessage());
+ }
+
+ /**
+ * Test the argument is logged.
+ */
+ public void testEventWithOneArg() {
+ Monitor mon = factory.getMonitor(Monitor.class);
+ mon.eventWithOneArg("ARG");
+ assertEquals(1, HANDLER.logs.size());
+ LogRecord record = HANDLER.logs.get(0);
+ assertEquals(Monitor.class.getName() + "#eventWithOneArg", record.getMessage());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ LOGGER.setUseParentHandlers(false);
+ LOGGER.addHandler(HANDLER);
+ HANDLER.flush();
+
+ String sourceClass = Monitor.class.getName();
+ Properties levels = new Properties();
+ levels.setProperty(sourceClass + "#eventWithNoArgs", "INFO");
+ levels.setProperty(sourceClass + "#eventWithOneArg", "INFO");
+ levels.setProperty(sourceClass + "#eventWithThrowable", "WARNING");
+ factory = new JavaLoggingMonitorFactory(levels, Level.FINE, "TestMessages");
+ }
+
+ protected void tearDown() throws Exception {
+ LOGGER.removeHandler(HANDLER);
+ HANDLER.flush();
+ super.tearDown();
+ }
+
+ /**
+ * Mock log HANDLER to capture records.
+ */
+ public static class MockHandler extends Handler {
+ List<LogRecord> logs = new ArrayList<LogRecord>();
+
+ public void publish(LogRecord record) {
+ logs.add(record);
+ }
+
+ public void flush() {
+ logs.clear();
+ }
+
+ public void close() throws SecurityException {
+ }
+ }
+
+ @SuppressWarnings({"JavaDoc"})
+ public static interface Monitor {
+ void eventNotToLog();
+
+ @LogLevel("INFO")
+ void eventWithNoArgs();
+
+ @LogLevel("INFO")
+ void eventWithOneArg(String msg);
+
+ @LogLevel("WARNING")
+ void eventWithThrowable(Exception e);
+
+ @LogLevel("INFO")
+ void eventWithAnnotation();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java
new file mode 100644
index 0000000000..40cf2e27cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.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.implementation.java.util;
+
+
+public class Bean1 extends SuperBean {
+
+ public static final int ALL_BEAN1_FIELDS = 6 + ALL_SUPER_FIELDS;
+ public static final int ALL_BEAN1_PUBLIC_PROTECTED_FIELDS = 5 + ALL_SUPER_PUBLIC_PROTECTED_FIELDS;
+ public static final int ALL_BEAN1_METHODS = 4 + ALL_SUPER_METHODS - 1;
+ public String field3;
+ protected String field2;
+ private String field1;
+
+ public void setMethod1(String param) {
+ }
+
+ public void setMethod1(int param) {
+ }
+
+ public void override(String param) throws Exception {
+ }
+
+
+ public void noOverride(String param) throws Exception {
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java
new file mode 100644
index 0000000000..a00b9e7109
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.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.implementation.java.util;
+
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+public class Bean2 {
+
+ private List methodList;
+ private List fieldList;
+
+ public List getMethodList() {
+ return methodList;
+ }
+
+ public void setMethodList(List list) {
+ methodList = list;
+ }
+
+ public List getfieldList() {
+ return fieldList;
+ }
+
+ public void setfieldList(List list) {
+ throw new AssertionFailedError("setter inadvertantly called");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
new file mode 100644
index 0000000000..1c8f1caa93
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.util;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.implementation.java.mock.Target;
+
+public class JavaIntrospectionHelperTestCase extends TestCase {
+
+ private List testNoGenericsList;
+ private List<String> testList;
+ private Map<String, Bean1> testMap;
+ private Target[] testArray;
+ private String[] testStringArray;
+
+ public JavaIntrospectionHelperTestCase() {
+ super();
+ }
+
+ public JavaIntrospectionHelperTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void testBean1AllPublicProtectedFields() throws Exception {
+ Set<Field> beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class);
+ assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS
+ }
+
+ public void testGetSuperAllMethods() throws Exception {
+ Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class);
+ assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size());
+ }
+
+ public void testGetBean1AllMethods() throws Exception {
+ Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size());
+ }
+
+ public void testOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ boolean invoked = false;
+ for (Method method : beanFields) {
+ if (method.getName().equals("override")) {
+ method.invoke(new Bean1(), "foo");
+ invoked = true;
+ }
+ }
+ if (!invoked) {
+ throw new Exception("Override never invoked");
+ }
+ }
+
+ public void testNoOverrideMethod() throws Exception {
+ Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class);
+ boolean found = false;
+ for (Method method : beanFields) {
+ if (method.getName().equals("noOverride") && method.getParameterTypes().length == 0) {
+ found = true;
+ }
+ }
+ if (!found) {
+ throw new Exception("No override not found");
+ }
+ }
+
+ public void testDefaultConstructor() throws Exception {
+ Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class);
+ assertEquals(ctr, Bean2.class.getConstructor());
+ assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass());
+ }
+
+
+ public void testGetAllInterfaces() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Z.class);
+ assertEquals(2, interfaces.size());
+ assertTrue(interfaces.contains(W.class));
+ assertTrue(interfaces.contains(W2.class));
+ }
+
+
+ public void testGetAllInterfacesObject() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Object.class);
+ assertEquals(0, interfaces.size());
+ }
+
+ public void testGetAllInterfacesNoInterfaces() {
+ Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(NoInterface.class);
+ assertEquals(0, interfaces.size());
+ }
+
+ /**
+ * Tests generics introspection capabilities
+ */
+ public void testGenerics() throws Exception {
+
+ List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType());
+ assertEquals(1, classes.size());
+ assertEquals(String.class, classes.get(0));
+
+ classes =
+ JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType());
+ assertEquals(0, classes.size());
+
+ classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType());
+ assertEquals(2, classes.size());
+ assertEquals(String.class, classes.get(0));
+ assertEquals(Bean1.class, classes.get(1));
+
+ classes = JavaIntrospectionHelper
+ .getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]);
+ assertEquals(2, classes.size());
+ assertEquals(String.class, classes.get(0));
+ assertEquals(Bean1.class, classes.get(1));
+
+ classes = JavaIntrospectionHelper
+ .getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]);
+ assertEquals(1, classes.size());
+ assertEquals(String.class, classes.get(0));
+
+ }
+
+ private void fooMethod(List<String> foo) {
+
+ }
+
+ private void fooMethod(Map<String, Bean1> foo) {
+
+ }
+
+ public void setTestArray(Target[] array) {
+ }
+
+ private interface W {
+
+ }
+
+ private interface W2 {
+
+ }
+
+ private class X implements W {
+
+ }
+
+ private class Y extends X implements W, W2 {
+
+ }
+
+ private class Z extends Y {
+
+ }
+
+ private class NoInterface {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java
new file mode 100644
index 0000000000..408cedb8be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.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.implementation.java.util;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SuperBean {
+
+ public static final int ALL_SUPER_FIELDS = 6;
+ public static final int ALL_SUPER_PUBLIC_PROTECTED_FIELDS = 5;
+ public static final int ALL_SUPER_METHODS = 4;
+ public String superField2;
+
+ protected String superField3;
+
+ private String superField1;
+
+ public void setSuperMethod1(String param) {
+ }
+
+ public void setSuperMethod1(int param) {
+ }
+
+ public void override(String param) throws Exception {
+ throw new Exception("Override not handled");
+ }
+
+ public void noOverride() throws Exception {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/.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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/pom.xml
new file mode 100644
index 0000000000..829f2433b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java-xml</artifactId>
+ <name>Apache Tuscany SCA XML Java Implementation Extension</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/LogLevel.java
new file mode 100644
index 0000000000..47e205f074
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/LogLevel.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.api.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that can be applied to methods in a monitoring interface to indicate to logging frameworks the severity of
+ * the event.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface LogLevel {
+
+ /**
+ * The log level as specified by {@link java.util.logging.Level}.
+ */
+ @SuppressWarnings({"JavaDoc"}) String value();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Monitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Monitor.java
new file mode 100644
index 0000000000..dea9489e5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Monitor.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.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * A system annotation to inject a monitor
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Monitor {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java
new file mode 100644
index 0000000000..a7158ab6b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.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.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a resource should be provided to an implementation by the runtime.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Resource {
+
+ /**
+ * Denotes the name of the resource declared by the implementation.
+ */
+ String name() default "";
+
+ /**
+ * Denotes if the resource is optional
+ */
+ boolean optional() default false;
+
+ /**
+ * Denotes the default name of the resource provided by the runtime environment.
+ */
+ String mappedName() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorExtensionPoint.java
new file mode 100644
index 0000000000..5442bdd377
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorExtensionPoint.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.implementation.java.introspect;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of the <code>IntrospectionRegistry</code>
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaClassIntrospectorExtensionPoint implements JavaClassIntrospectorExtensionPoint {
+
+ private List<JavaClassVisitor> visitors = new ArrayList<JavaClassVisitor>();
+
+ public DefaultJavaClassIntrospectorExtensionPoint() {
+ }
+
+ public void addClassVisitor(JavaClassVisitor visitor) {
+ visitors.add(visitor);
+ }
+
+ public void removeClassVisitor(JavaClassVisitor visitor) {
+ visitors.remove(visitor);
+ }
+
+ public List<JavaClassVisitor> getClassVisitors() {
+ return visitors;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DuplicatePropertyException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DuplicatePropertyException.java
new file mode 100644
index 0000000000..43ebf79b91
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/DuplicatePropertyException.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.sca.implementation.java.introspect;
+
+/**
+ * Thrown when an implementation has more than one property injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicatePropertyException extends IntrospectionException {
+ private static final long serialVersionUID = 5536415875694904037L;
+
+ public DuplicatePropertyException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/ExtensibleJavaClassIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/ExtensibleJavaClassIntrospector.java
new file mode 100644
index 0000000000..332eb96206
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/ExtensibleJavaClassIntrospector.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
+
+/**
+ * An extensible Java class introspector implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleJavaClassIntrospector implements JavaClassIntrospector {
+
+ private List<JavaClassVisitor> visitors;
+
+ public ExtensibleJavaClassIntrospector(JavaClassIntrospectorExtensionPoint visitors) {
+ this.visitors = visitors.getClassVisitors();
+ }
+
+ /**
+ * JSR-250 PFD recommends the following guidelines for how annotations
+ * interact with inheritance in order to keep the resulting complexity in
+ * control:
+ * <ol>
+ * <li>Class-level annotations only affect the class they annotate and
+ * their members, that is, its methods and fields. They never affect a
+ * member declared by a superclass, even if it is not hidden or overridden
+ * by the class in question.
+ * <li>In addition to affecting the annotated class, class-level
+ * annotations may act as a shorthand for member-level annotations. If a
+ * member carries a specific member-level annotation, any annotations of the
+ * same type implied by a class-level annotation are ignored. In other
+ * words, explicit member-level annotations have priority over member-level
+ * annotations implied by a class-level annotation.
+ * <li>The interfaces implemented by a class never contribute annotations
+ * to the class itself or any of its members.
+ * <li>Members inherited from a superclass and which are not hidden or
+ * overridden maintain the annotations they had in the class that declared
+ * them, including member-level annotations implied by class-level ones.
+ * <li>Member-level annotations on a hidden or overridden member are always
+ * ignored.
+ * </ol>
+ */
+ public JavaImplementation introspect(Class<?> clazz, JavaImplementation type)
+ throws IntrospectionException {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitClass(clazz, type);
+ }
+
+ for (Constructor<?> constructor : clazz.getConstructors()) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitConstructor(constructor, type);
+ // Assuming the visitClass or visitConstructor will populate the
+ // type.getConstructors
+ JavaConstructorImpl<?> definition = type.getConstructors().get(constructor);
+ if (definition != null) {
+ for (JavaParameterImpl p : definition.getParameters()) {
+ extension.visitConstructorParameter(p, type);
+ }
+ }
+ }
+ }
+
+ Set<Method> methods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(clazz);
+ for (Method method : methods) {
+ for (JavaClassVisitor processor : visitors) {
+ processor.visitMethod(method, type);
+ }
+ }
+
+ Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz);
+ for (Field field : fields) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitField(field, type);
+ }
+ }
+
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null) {
+ visitSuperClass(superClass, type);
+ }
+
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitEnd(clazz, type);
+ }
+ return type;
+ }
+
+ private void visitSuperClass(Class<?> clazz, JavaImplementation type) throws IntrospectionException {
+ if (!Object.class.equals(clazz)) {
+ for (JavaClassVisitor extension : visitors) {
+ extension.visitSuperClass(clazz, type);
+ }
+ clazz = clazz.getSuperclass();
+ if (clazz != null) {
+ visitSuperClass(clazz, type);
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IllegalPropertyException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IllegalPropertyException.java
new file mode 100644
index 0000000000..c6494b3d74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IllegalPropertyException.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.implementation.java.introspect;
+
+import java.lang.reflect.Member;
+
+/**
+ * Denotes an illegal property definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalPropertyException extends IntrospectionException {
+ private static final long serialVersionUID = -2836849110706758494L;
+
+ public IllegalPropertyException(String message) {
+ super(message);
+ }
+
+ public IllegalPropertyException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IntrospectionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IntrospectionException.java
new file mode 100644
index 0000000000..45eaf0235b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/IntrospectionException.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.implementation.java.introspect;
+
+import java.lang.reflect.Member;
+
+/**
+ * Denotes a problem processing annotations on a POJO implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntrospectionException extends Exception {
+ private static final long serialVersionUID = -361025119035104470L;
+ private Member member;
+
+ public IntrospectionException() {
+ }
+
+ public IntrospectionException(String message) {
+ super(message);
+ }
+
+ public IntrospectionException(String message, Member member) {
+ super(message);
+ this.member = member;
+ }
+
+ public IntrospectionException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public IntrospectionException(Throwable cause) {
+ super(cause);
+ }
+
+ public Member getMember() {
+ return member;
+ }
+
+ public void setMember(Member member) {
+ this.member = member;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospector.java
new file mode 100644
index 0000000000..7fec71a709
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospector.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.sca.implementation.java.introspect;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+
+/**
+ * Implementations are responsible for walking a component implementation class,
+ * adding additional component type information as appropriate
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaClassIntrospector {
+
+ /**
+ * Walks the given component implementation class
+ *
+ * @param clazz the component implementation class
+ * @param type the component type associated with the implementation class
+ * @return the updated component type
+ * @throws IntrospectionException if an error is encountered evaluating the
+ * implementation class
+ */
+ JavaImplementation introspect(Class<?> clazz, JavaImplementation type) throws IntrospectionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospectorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospectorExtensionPoint.java
new file mode 100644
index 0000000000..5da3c1ff11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassIntrospectorExtensionPoint.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.implementation.java.introspect;
+
+import java.util.List;
+
+/**
+ * An extension point for Java class visitors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaClassIntrospectorExtensionPoint {
+
+ /**
+ * Registers the given visitor.
+ *
+ * @param visitor
+ */
+ void addClassVisitor(JavaClassVisitor visitor);
+
+ /**
+ * Deregisters the given visitor.
+ */
+ void removeClassVisitor(JavaClassVisitor visitor);
+
+ /**
+ * Returns the list of visitors.
+ *
+ * @return
+ */
+ List<JavaClassVisitor> getClassVisitors();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java
new file mode 100644
index 0000000000..f4b7446225
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.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.sca.implementation.java.introspect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+
+/**
+ * Implementations process class-level metadata, typically parsing annotations
+ * and updating the corresponding <code>ComponentType</code>. A processor
+ * may, for example, create a Property which is responsible for injecting a
+ * complex type on a component implementation instance when it is instantiated.
+ * <p/> Processors will receive callbacks as the implementation class is walked
+ * while evalauting an assembly. It is the responsibility of the parser to
+ * determine whether to perform an action during the callback.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaClassVisitor {
+
+ /**
+ * A callback received when the component implementation class is first
+ * loaded
+ *
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation class hierarchy is
+ * evaluated
+ *
+ * @param clazz the superclass in the component implmentation's class
+ * hierarchy
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation's public and
+ * protected methods are evaluated
+ *
+ * @param method the current public or protected method being evaluated
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ void visitMethod(Method method, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation's constructor used
+ * for instantiation by the runtime is evaluated. If an implementation
+ * contains more than one constructor, the constructor passed to the
+ * callback will be chosen according to the algorithm described in the SCA
+ * Java Client and Implementation Model Specification.
+ *
+ * @param constructor the constructor used for instantiating component
+ * implementation instances
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * @param parameter
+ * @param type
+ * @throws IntrospectionException
+ */
+ void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * A callback received as the component implementation's public and
+ * protected fields are evaluated
+ *
+ * @param field the current public or protected field being evaluated
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ void visitField(Field field, JavaImplementation type) throws IntrospectionException;
+
+ /**
+ * The final callback received when all other callbacks during evaluation of
+ * the component implementation have been issued
+ *
+ * @param clazz the component implementation class
+ * @param type the incomplete component type associated with the
+ * implementation class
+ * @throws IntrospectionException if an error is encountered while processing
+ * metadata
+ */
+ <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
new file mode 100644
index 0000000000..f4c78d34ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.DuplicatePropertyException;
+import org.apache.tuscany.sca.implementation.java.introspect.IllegalPropertyException;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+
+/**
+ * Base class for ImplementationProcessors that handle annotations that add
+ * Properties.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractPropertyProcessor<A extends Annotation> extends BaseJavaClassVisitor {
+ private final Class<A> annotationClass;
+
+ protected AbstractPropertyProcessor(AssemblyFactory assemblyFactory, Class<A> annotationClass) {
+ super(assemblyFactory);
+ this.annotationClass = annotationClass;
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ A annotation = method.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ if (!Void.TYPE.equals(method.getReturnType())) {
+ throw new IllegalPropertyException("Method does not have void return type", method);
+ }
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length != 1) {
+ throw new IllegalPropertyException("Method must have a single parameter", method);
+ }
+
+ String name = getName(annotation);
+ if (name == null || "".equals(name)) {
+ name = method.getName();
+ if (name.startsWith("set")) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ }
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ if (properties.containsKey(name)) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ Property property = createProperty(name, element);
+
+ // add databinding available as annotations, as extensions
+
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, element);
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ A annotation = field.getAnnotation(annotationClass);
+ if (annotation == null) {
+ return;
+ }
+
+ String name = getName(annotation);
+ if (name == null) {
+ name = "";
+ }
+ if ("".equals(name) || name.equals(field.getType().getName())) {
+ name = field.getName();
+ }
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ if (properties.containsKey(name)) {
+ throw new DuplicatePropertyException(name);
+ }
+
+ JavaElementImpl element = new JavaElementImpl(field);
+ Property property = createProperty(name, element);
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, element);
+ }
+
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ A annotation = parameter.getAnnotation(annotationClass);
+ if (annotation != null) {
+ String name = getName(annotation);
+ if (name == null) {
+ name = parameter.getType().getName();
+ }
+ if (!"".equals(name) && !"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
+ throw new InvalidConstructorException("Mismatched property name: " + parameter);
+ }
+ if ("".equals(name) && "".equals(parameter.getName())) {
+ throw new InvalidPropertyException("Missing property name: " + parameter);
+ }
+ if ("".equals(name)) {
+ name = parameter.getName();
+ }
+
+ if (properties.containsKey(name)) {
+ throw new DuplicatePropertyException("Duplication property: " + name);
+ }
+ parameter.setName(name);
+ parameter.setClassifer(annotationClass);
+ Property property = createProperty(name, parameter);
+ initProperty(property, annotation);
+ type.getProperties().add(property);
+ properties.put(name, parameter);
+ }
+ }
+
+ protected abstract String getName(A annotation);
+
+ protected abstract void initProperty(Property property, A annotation) throws IntrospectionException;
+
+ @SuppressWarnings("unchecked")
+ protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException {
+
+ Property property = assemblyFactory.createProperty();
+ property.setName(name);
+ Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ property.setXSDType(JavaXMLMapper.getXMLType(baseType));
+
+ Class<?> javaType = element.getType();
+ if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
+ property.setMany(true);
+ }
+ return property;
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java
new file mode 100644
index 0000000000..ab39106521
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * Processes {@link AllowsPassByReference} on an implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class AllowsPassByReferenceProcessor extends BaseJavaClassVisitor {
+
+ public AllowsPassByReferenceProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ type.setAllowsPassByReference(clazz.isAnnotationPresent(AllowsPassByReference.class));
+ }
+
+ @Override
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ boolean pbr = method.isAnnotationPresent(AllowsPassByReference.class);
+ if (pbr) {
+ type.getAllowsPassByReferenceMethods().add(method);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java
new file mode 100644
index 0000000000..329a4ae4be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when constructor parameters cannot be unambiguously resolved to a property or reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class AmbiguousConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = 3662860753837091880L;
+
+ public AmbiguousConstructorException(String message) {
+ super(message);
+ }
+
+ public AmbiguousConstructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java
new file mode 100644
index 0000000000..cdc9e68996
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+/**
+ * A convenience class for annotation processors which alleviates the need to
+ * implement unused callbacks
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseJavaClassVisitor implements JavaClassVisitor {
+ protected AssemblyFactory assemblyFactory;
+
+ protected BaseJavaClassVisitor(AssemblyFactory factory) {
+ this.assemblyFactory = factory;
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ }
+
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java
new file mode 100644
index 0000000000..e28bf21d81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Handles processing of a constructor decorated with
+ * {@link org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unchecked")
+public class ConstructorProcessor extends BaseJavaClassVisitor {
+
+ public ConstructorProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ Constructor[] ctors = clazz.getConstructors();
+ boolean found = false;
+ for (Constructor constructor : ctors) {
+ JavaConstructorImpl<?> definition = new JavaConstructorImpl(constructor);
+ type.getConstructors().put(constructor, definition);
+ if (constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
+ if (found) {
+ throw new DuplicateConstructorException("Multiple constructors marked with @Constructor", constructor);
+ }
+ found = true;
+ type.setConstructor(definition);
+ }
+ }
+ }
+
+ public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type)
+ throws IntrospectionException {
+ org.osoa.sca.annotations.Constructor annotation = constructor
+ .getAnnotation(org.osoa.sca.annotations.Constructor.class);
+ if (annotation == null) {
+ return;
+ }
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ if (definition == null) {
+ definition = new JavaConstructorImpl(constructor);
+ type.setConstructor(definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ String[] value = annotation.value();
+ boolean isDefault = value.length == 0 || (value.length == 1 && "".equals(value[0]));
+ if (!isDefault && value.length != parameters.length) {
+ throw new InvalidConstructorException("Invalid Nubmer of names in @Constructor");
+ }
+ for (int i = 0; i < parameters.length; i++) {
+ parameters[i].setName(i < value.length ? value[i] : "");
+ }
+ type.setConstructor(definition);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
new file mode 100644
index 0000000000..823f4c6bda
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+
+/**
+ * Processes {@link @Context} annotations on a component implementation and adds
+ * a {@link JavaMappedProperty} to the component type which will be used to
+ * inject the appropriate context
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessor extends BaseJavaClassVisitor {
+
+ public ContextProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ if (method.getAnnotation(Context.class) == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalContextException("Context setter must have one parameter", method);
+ }
+ Class<?> paramType = method.getParameterTypes()[0];
+ String name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ element.setName(name);
+ element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ if (field.getAnnotation(Context.class) == null) {
+ return;
+ }
+ Class<?> paramType = field.getType();
+ if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
+ JavaElementImpl element = new JavaElementImpl(field);
+ element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
+ type.getResources().put(resource.getName(), resource);
+ } else {
+ throw new UnknownContextTypeException(paramType.getName());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
new file mode 100644
index 0000000000..adc3802e99
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationProcessor extends BaseJavaClassVisitor {
+ private static final String SECONDS = " SECONDS";
+ private static final String MINUTES = " MINUTES";
+ private static final String HOURS = " HOURS";
+ private static final String DAYS = " DAYS";
+ private static final String YEARS = " YEARS";
+
+ public ConversationProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+
+ ConversationAttributes conversation = clazz.getAnnotation(ConversationAttributes.class);
+ if (conversation == null) {
+ return;
+ }
+ Scope scope = clazz.getAnnotation(Scope.class);
+ if (scope == null) {
+ // implicitly assume conversation
+ type.setJavaScope(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION);
+ } else if (scope != null && !"CONVERSATION".equals(scope.value().toUpperCase())) {
+ throw new InvalidConversationalImplementation(
+ "Service is marked with @ConversationAttributes but the scope is not @Scope(\"CONVERSATION\")"
+ );
+ } else if (conversation != null) {
+ long maxAge;
+ long maxIdleTime;
+ String maxAgeVal = conversation.maxAge();
+ String maxIdleTimeVal = conversation.maxIdleTime();
+ if (maxAgeVal.length() > 0 && maxIdleTimeVal.length() > 0) {
+ throw new InvalidConversationalImplementation("Max idle time and age both specified");
+ }
+ try {
+ if (maxAgeVal.length() > 0) {
+ maxAge = convertTimeMillis(maxAgeVal);
+ type.setMaxAge(maxAge);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum age", e);
+ }
+ try {
+ if (maxIdleTimeVal.length() > 0) {
+ maxIdleTime = convertTimeMillis(maxIdleTimeVal);
+ type.setMaxIdleTime(maxIdleTime);
+ }
+ } catch (NumberFormatException e) {
+ throw new InvalidConversationalImplementation("Invalid maximum idle time", e);
+ }
+ }
+
+ }
+
+ public void visitMethod(Method method,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = method.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.setConversationIDMember(method);
+ }
+
+ public void visitField(Field field,
+ JavaImplementation type) throws IntrospectionException {
+ ConversationID conversationID = field.getAnnotation(ConversationID.class);
+ if (conversationID == null) {
+ return;
+ }
+ type.setConversationIDMember(field);
+ }
+
+ protected long convertTimeMillis(String expr) throws NumberFormatException {
+ expr = expr.trim().toUpperCase();
+ int i = expr.lastIndexOf(SECONDS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 1000;
+ }
+ i = expr.lastIndexOf(MINUTES);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 60000;
+ }
+
+ i = expr.lastIndexOf(HOURS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 3600000;
+ }
+ i = expr.lastIndexOf(DAYS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 86400000;
+ }
+ i = expr.lastIndexOf(YEARS);
+ if (i >= 0) {
+ String units = expr.substring(0, i);
+ return Long.parseLong(units) * 31556926000L;
+ }
+ return Long.parseLong(expr) * 1000; // assume seconds if no suffix
+ // specified
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
new file mode 100644
index 0000000000..bd6ae041a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * Processes the {@link @Destroy} annotation on a component implementation and
+ * updates the component type with the decorated destructor method
+ *
+ * @version $Rev$ $Date$
+ */
+public class DestroyProcessor extends BaseJavaClassVisitor {
+
+ public DestroyProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Destroy annotation = method.getAnnotation(Destroy.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalDestructorException("Destructor must not have argments", method);
+ }
+ if (type.getDestroyMethod() != null) {
+ throw new DuplicateDestructorException("More than one destructor found on implementation");
+ }
+ if (Modifier.isProtected(method.getModifiers())) {
+ method.setAccessible(true);
+ }
+ type.setDestroyMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java
new file mode 100644
index 0000000000..46f1556b7e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when more than one component implementation constructor is annotated with {@link
+ * org.osoa.sca.annotations.Constructor}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = -5926763756570552986L;
+
+ public DuplicateConstructorException(String message) {
+ super(message);
+ }
+
+ public DuplicateConstructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java
new file mode 100644
index 0000000000..e32a3a3d5b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateDestructorException extends IntrospectionException {
+ private static final long serialVersionUID = -7474912510114895203L;
+
+ public DuplicateDestructorException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java
new file mode 100644
index 0000000000..0967ef6309
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when an implementation is annotated multiple times with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateInitException extends IntrospectionException {
+ private static final long serialVersionUID = -6282935288115512057L;
+
+ public DuplicateInitException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java
new file mode 100644
index 0000000000..72f417244c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one reference injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = 907910648213477158L;
+
+ public DuplicateReferenceException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java
new file mode 100644
index 0000000000..db1b81e556
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one resource injection site with the same name
+ *
+ * @version $Rev$ $Date$
+ */
+public class DuplicateResourceException extends IntrospectionException {
+
+ private static final long serialVersionUID = 1619276459330463299L;
+
+ public DuplicateResourceException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java
new file mode 100644
index 0000000000..6f4d0d5194
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * Handles processing of {@link org.osoa.sca.annotations.EagerInit}
+ *
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessor extends BaseJavaClassVisitor {
+
+ public EagerInitProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public <T> void visitClass(Class<T> clazz,
+ JavaImplementation type) throws IntrospectionException {
+ super.visitClass(clazz, type);
+ EagerInit annotation = clazz.getAnnotation(EagerInit.class);
+ if (annotation == null) {
+ Class<?> superClass = clazz.getSuperclass();
+ while (!Object.class.equals(superClass)) {
+ annotation = superClass.getAnnotation(EagerInit.class);
+ if (annotation != null) {
+ break;
+ }
+ superClass = superClass.getSuperclass();
+ }
+ if (annotation == null) {
+ return;
+ }
+ }
+ type.setEagerInit(true);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
new file mode 100644
index 0000000000..7a12d833c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
@@ -0,0 +1,658 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.toPropertyName;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.tuscany.api.annotation.Monitor;
+import org.apache.tuscany.api.annotation.Resource;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Context;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Heuristically evaluates an un-annotated Java implementation type to determine
+ * services, references, and properties according to the algorithm described in
+ * the SCA Java Client and Implementation Model Specification <p/> TODO
+ * Implement: <p/> When no service inteface is annotated, need to calculate a
+ * single service comprising all public methods that are not reference or
+ * property injection sites. If that service can be exactly mapped to an
+ * interface implemented by the class then the service interface will be defined
+ * in terms of that interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeuristicPojoProcessor extends BaseJavaClassVisitor {
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector interfaceIntrospector;
+
+ public HeuristicPojoProcessor(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector interfaceIntrospector) {
+ super(assemblyFactory);
+ this.interfaceIntrospector = interfaceIntrospector;
+ this.javaFactory = javaFactory;
+ }
+
+ public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ List<org.apache.tuscany.sca.assembly.Service> services = type.getServices();
+ if (services.isEmpty()) {
+ // heuristically determine the service
+ // TODO finish algorithm
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ if (interfaces.size() == 0) {
+ // class is the interface
+ addService(type, clazz);
+ } else if (interfaces.size() == 1) {
+ // Only one interface, take it
+ addService(type, interfaces.iterator().next());
+ }
+ }
+ Set<Method> methods = getAllUniquePublicProtectedMethods(clazz);
+ if (!type.getReferenceMembers().isEmpty() || !type.getPropertyMembers().isEmpty()) {
+ // references and properties have been explicitly defined
+ if (type.getServices().isEmpty()) {
+ calculateServiceInterface(clazz, type, methods);
+ if (type.getServices().isEmpty()) {
+ throw new ServiceTypeNotFoundException(clazz.getName());
+ }
+ }
+ evaluateConstructor(type, clazz);
+ return;
+ }
+ calcPropRefs(methods, services, type, clazz);
+ evaluateConstructor(type, clazz);
+ }
+
+ private void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
+ try {
+ org.apache.tuscany.sca.assembly.Service service = createService(clazz);
+ type.getServices().add(service);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ }
+
+ private boolean isPublicSetter(Method method) {
+ return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
+ && method.getName().startsWith("set")
+ && method.getReturnType() == void.class;
+ }
+
+ private boolean isProtectedSetter(Method method) {
+ return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
+ && method.getName().startsWith("set")
+ && method.getReturnType() == void.class;
+ }
+
+ private <T> void calcPropRefs(Set<Method> methods,
+ List<org.apache.tuscany.sca.assembly.Service> services,
+ JavaImplementation type,
+ Class<T> clazz) throws IntrospectionException {
+ // heuristically determine the properties references
+ // make a first pass through all public methods with one param
+ Set<String> setters = new HashSet<String>();
+ for (Method method : methods) {
+ if (!isPublicSetter(method)) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ if (!isInServiceInterface(method, services)) {
+ // Not part of the service interface
+ String name = toPropertyName(method.getName());
+ setters.add(name);
+ // avoid duplicate property or ref names
+ if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
+ Class<?> param = method.getParameterTypes()[0];
+ Type genericType = method.getGenericParameterTypes()[0];
+ if (isReferenceType(param, genericType)) {
+ type.getReferences().add(createReference(name, param));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
+ } else {
+ type.getProperties().add(createProperty(name, param));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ }
+ }
+ }
+ // second pass for protected methods with one param
+ for (Method method : methods) {
+ if (!isProtectedSetter(method)) {
+ continue;
+ }
+ if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ Class<?> param = method.getParameterTypes()[0];
+ String name = toPropertyName(method.getName());
+ setters.add(name);
+ // avoid duplicate property or ref names
+ if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
+ if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
+ type.getReferences().add(createReference(name, param));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
+ } else {
+ type.getProperties().add(createProperty(name, param));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
+ }
+ }
+ }
+
+ // Public or protected fields unless there is a public or protected
+ // setter method
+ // for the same name
+ Set<Field> fields = getAllPublicAndProtectedFields(clazz);
+ for (Field field : fields) {
+ if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
+ continue;
+ }
+ if (setters.contains(field.getName())) {
+ continue;
+ }
+ String name = field.getName();
+ Class<?> paramType = field.getType();
+ if (isReferenceType(paramType, field.getGenericType())) {
+ type.getReferences().add(createReference(name, paramType));
+ type.getReferenceMembers().put(name, new JavaElementImpl(field));
+ } else {
+ type.getProperties().add(createProperty(name, paramType));
+ type.getPropertyMembers().put(name, new JavaElementImpl(field));
+ }
+ }
+ }
+
+ /**
+ * Determines the constructor to use based on the component type's
+ * references and properties
+ *
+ * @param type the component type
+ * @param clazz the implementation class corresponding to the component type
+ * @throws NoConstructorException if no suitable constructor is found
+ * @throws AmbiguousConstructorException if the parameters of a constructor
+ * cannot be unambiguously mapped to references and properties
+ */
+ @SuppressWarnings("unchecked")
+ private <T> void evaluateConstructor(JavaImplementation type, Class<T> clazz) throws IntrospectionException {
+ // determine constructor if one is not annotated
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ Constructor constructor;
+ boolean explict = false;
+ if (definition != null && definition.getConstructor()
+ .isAnnotationPresent(org.osoa.sca.annotations.Constructor.class)) {
+ // the constructor was already defined explicitly
+ return;
+ } else if (definition != null) {
+ explict = true;
+ constructor = definition.getConstructor();
+ } else {
+ // no definition, heuristically determine constructor
+ Constructor[] constructors = clazz.getConstructors();
+ if (constructors.length == 0) {
+ throw new NoConstructorException("No public constructor for class");
+ } else if (constructors.length == 1) {
+ // Only one constructor, take it
+ constructor = constructors[0];
+ } else {
+ // FIXME multiple constructors, none yet done
+ Constructor<T> selected = null;
+ int sites = type.getPropertyMembers().size() + type.getReferenceMembers().size();
+ for (Constructor<T> ctor : constructors) {
+ if (ctor.getParameterTypes().length == 0) {
+ selected = ctor;
+ }
+ if (ctor.getParameterTypes().length == sites) {
+ // TODO finish
+ // selected = constructor;
+ // select constructor
+ // break;
+ }
+ }
+ if (selected == null) {
+ throw new NoConstructorException();
+ }
+ constructor = selected;
+ definition = type.getConstructors().get(selected);
+ type.setConstructor(definition);
+ // return;
+ }
+ definition = type.getConstructors().get(constructor);
+ type.setConstructor(definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ if (parameters.length == 0) {
+ return;
+ }
+ Map<String, JavaElementImpl> props = type.getPropertyMembers();
+ Map<String, JavaElementImpl> refs = type.getReferenceMembers();
+ Annotation[][] annotations = constructor.getParameterAnnotations();
+ if (!explict) {
+ // the constructor wasn't defined by an annotation, so check to see
+ // if any of the params have an annotation
+ // which we can impute as explicitly defining the constructor, e.g.
+ // @Property, @Reference, or @Autowire
+ explict = injectionAnnotationsPresent(annotations);
+ }
+ if (explict) {
+ for (int i = 0; i < parameters.length; i++) {
+ if (isAnnotated(parameters[i])) {
+ continue;
+ } else if (!findReferenceOrProperty(parameters[i], props, refs)) {
+ throw new AmbiguousConstructorException(parameters[i].toString());
+ }
+ }
+ } else {
+ if (!areUnique(parameters)) {
+ throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
+ }
+ if (!calcPropRefUniqueness(props.values(), refs.values())) {
+ throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
+ }
+ if (!(props.isEmpty() && refs.isEmpty())) {
+ calcParamNames(parameters, props, refs);
+ } else {
+ heuristicParamNames(type, parameters);
+
+ }
+ }
+ }
+
+ private void calcParamNames(JavaParameterImpl[] parameters,
+ Map<String, JavaElementImpl> props,
+ Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
+ // the constructor param types must unambiguously match defined
+ // reference or property types
+ for (JavaParameterImpl param : parameters) {
+ if (!findReferenceOrProperty(param, props, refs)) {
+ throw new AmbiguousConstructorException(param.getName());
+ }
+ }
+ }
+
+ private void heuristicParamNames(JavaImplementation type, JavaParameterImpl[] parameters)
+ throws IntrospectionException {
+ // heuristically determine refs and props from the parameter types
+ for (JavaParameterImpl p : parameters) {
+ String name = p.getType().getSimpleName().toLowerCase();
+ if (isReferenceType(p.getType(), p.getGenericType())) {
+ type.getReferences().add(createReference(name, p.getType()));
+ p.setClassifer(Reference.class);
+ type.getReferenceMembers().put(name, p);
+ } else {
+ type.getProperties().add(createProperty(name, p.getType()));
+ p.setClassifer(Property.class);
+ type.getPropertyMembers().put(name, p);
+ }
+ p.setName(name);
+ }
+ }
+
+ private static boolean areUnique(Class[] collection) {
+ Set<Class> set = new HashSet<Class>(Arrays.asList(collection));
+ return set.size() == collection.length;
+ }
+
+ /**
+ * Returns true if the union of the given collections of properties and
+ * references have unique Java types
+ */
+ private boolean calcPropRefUniqueness(Collection<JavaElementImpl> props, Collection<JavaElementImpl> refs) {
+
+ Class[] classes = new Class[props.size() + refs.size()];
+ int i = 0;
+ for (JavaElementImpl property : props) {
+ classes[i] = property.getType();
+ i++;
+ }
+ for (JavaElementImpl reference : refs) {
+ classes[i] = reference.getType();
+ i++;
+ }
+ return areUnique(classes);
+ }
+
+ /**
+ * Unambiguously finds the reference or property associated with the given
+ * type
+ *
+ * @return the name of the reference or property if found, null if not
+ * @throws AmbiguousConstructorException if the constructor parameter cannot
+ * be resolved to a property or reference
+ */
+ private boolean findReferenceOrProperty(JavaParameterImpl parameter,
+ Map<String, JavaElementImpl> props,
+ Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
+
+ boolean found = false;
+ if (!"".equals(parameter.getName())) {
+ // Match by name
+ JavaElementImpl prop = props.get(parameter.getName());
+ if (prop != null && prop.getType() == parameter.getType()) {
+ parameter.setClassifer(Property.class);
+ return true;
+ }
+ JavaElementImpl ref = refs.get(parameter.getName());
+ if (ref != null && ref.getType() == parameter.getType()) {
+ parameter.setClassifer(Reference.class);
+ return true;
+ }
+ }
+ for (JavaElementImpl property : props.values()) {
+ if (property.getType() == parameter.getType()) {
+ if (found) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ (Member)parameter.getAnchor());
+ }
+ parameter.setClassifer(Property.class);
+ parameter.setName(property.getName());
+ found = true;
+ // do not break since ambiguities must be checked, i.e. more
+ // than one prop or ref of the same type
+ }
+ }
+ for (JavaElementImpl reference : refs.values()) {
+ if (reference.getType() == parameter.getType()) {
+ if (found) {
+ throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
+ (Member)parameter.getAnchor());
+ }
+ parameter.setClassifer(Reference.class);
+ parameter.setName(reference.getName());
+ found = true;
+ // do not break since ambiguities must be checked, i.e. more
+ // than one prop or ref of the same type
+ }
+ }
+ return found;
+ }
+
+ /**
+ * Returns true if a given type is reference according to the SCA
+ * specification rules for determining reference types The following rules
+ * are used to determine whether an unannotated field or setter method is a
+ * property or reference:
+ * <ol>
+ * <li>If its type is simple, then it is a property.
+ * <li>If its type is complex, then if the type is an interface marked by
+ *
+ * @Remotable, then it is a reference; otherwise, it is a property.
+ * <li>Otherwise, if the type associated with the member is an
+ * array or a java.util.Collection, the basetype is the element
+ * type of the array or the parameterized type of the
+ * Collection; otherwise the basetype is the member type. If the
+ * basetype is an interface with an
+ * @Remotable or
+ * @Service annotation then the memberis defined as a reference. Otherwise,
+ * it is defined as a property.
+ * </ol>
+ * <p>
+ * The name of the reference or of the property is derived from the
+ * name found on the setter method or on the field.
+ */
+ private boolean isReferenceType(Class<?> cls, Type genericType) {
+ Class<?> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
+ return baseType.isInterface() && (baseType.isAnnotationPresent(Remotable.class) || baseType
+ .isAnnotationPresent(Service.class));
+ }
+
+ /**
+ * Returns true if the given operation is defined in the collection of
+ * service interfaces
+ */
+ private boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
+ for (org.apache.tuscany.sca.assembly.Service service : services) {
+ Interface interface1 = service.getInterfaceContract().getInterface();
+ if (interface1 instanceof JavaInterface) {
+ Class<?> clazz = ((JavaInterface)interface1).getJavaClass();
+ if (isMethodMatched(clazz, operation)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Test if the class declares a method which matches the signature of the
+ * given method
+ *
+ * @param clazz
+ * @param method
+ * @return
+ */
+ private boolean isMethodMatched(Class<?> clazz, Method method) {
+ if (method.getDeclaringClass() == clazz) {
+ return true;
+ }
+ Method[] methods = clazz.getMethods();
+ for (Method m : methods) {
+ if (JavaIntrospectionHelper.exactMethodMatch(method, m)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Creates a mapped property
+ *
+ * @param name the property name
+ * @param member the injection site the reference maps to
+ * @param paramType the property type
+ */
+ private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
+ org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
+ property.setName(name);
+ property.setXSDType(JavaXMLMapper.getXMLType(paramType));
+ return property;
+ }
+
+ /**
+ * Populates a component type with a service whose interface type is
+ * determined by examining all implemented interfaces of the given class and
+ * chosing one whose operations match all of the class's non-property and
+ * non-reference methods
+ *
+ * @param clazz the class to examine
+ * @param type the component type
+ * @param methods all methods in the class to examine
+ */
+ private void calculateServiceInterface(Class<?> clazz, JavaImplementation type, Set<Method> methods)
+ throws IntrospectionException {
+ List<Method> nonPropRefMethods = new ArrayList<Method>();
+ // Map<String, Service> services = type.getServices();
+ Map<String, JavaElementImpl> references = type.getReferenceMembers();
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
+ // calculate methods that are not properties or references
+ for (Method method : methods) {
+ String name = toPropertyName(method.getName());
+ if (!references.containsKey(name) && !properties.containsKey(name)) {
+ nonPropRefMethods.add(method);
+ }
+ }
+ // determine if an implemented interface matches all of the non-property
+ // and non-reference methods
+ Class[] interfaces = clazz.getInterfaces();
+ if (interfaces.length == 0) {
+ return;
+ }
+ for (Class interfaze : interfaces) {
+ if (analyzeInterface(interfaze, nonPropRefMethods)) {
+ org.apache.tuscany.sca.assembly.Service service;
+ try {
+ service = createService(interfaze);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ type.getServices().add(service);
+ }
+ }
+ }
+
+ /**
+ * Determines if the methods of a given interface match the given list of
+ * methods
+ *
+ * @param interfaze the interface to examine
+ * @param nonPropRefMethods the list of methods to match against
+ * @return true if the interface matches
+ */
+ private boolean analyzeInterface(Class<?> interfaze, List<Method> nonPropRefMethods) {
+ Method[] interfaceMethods = interfaze.getMethods();
+ if (nonPropRefMethods.size() != interfaceMethods.length) {
+ return false;
+ }
+ for (Method method : nonPropRefMethods) {
+ boolean found = isMethodMatched(interfaze, method);
+ if (!found) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private boolean isAnnotated(JavaParameterImpl parameter) {
+ for (Annotation annotation : parameter.getAnnotations()) {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+ if (annotType.equals(Property.class) || annotType.equals(Reference.class)
+ || annotType.equals(Resource.class)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean areUnique(JavaParameterImpl[] parameters) {
+ Set<Class> set = new HashSet<Class>(parameters.length);
+ for (JavaParameterImpl p : parameters) {
+ if (!set.add(p.getType())) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
+ throws IntrospectionException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ reference.setName(name);
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+ try {
+ JavaInterface callInterface = interfaceIntrospector.introspect(paramType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ } catch (InvalidInterfaceException e1) {
+ throw new IntrospectionException(e1);
+ }
+ try {
+ processCallback(paramType, reference);
+ } catch (InvalidServiceType e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+
+ public org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+ org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
+ service.setName(interfaze.getSimpleName());
+
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+
+ Interface javaInterface = service.getInterfaceContract().getInterface();
+ javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
+ service.getInterfaceContract().setInterface(javaInterface);
+ return service;
+ }
+
+ public void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceType {
+ Callback callback = interfaze.getAnnotation(Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ Class<?> callbackClass = callback.value();
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setJavaClass(callbackClass);
+ contract.getInterfaceContract().setCallbackInterface(javaInterface);
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidServiceType("No callback interface specified on annotation", interfaze);
+ }
+ }
+
+ public boolean injectionAnnotationsPresent(Annotation[][] annots) {
+ for (Annotation[] annotations : annots) {
+ for (Annotation annotation : annotations) {
+ Class<? extends Annotation> annotType = annotation.annotationType();
+ if (annotType.equals(Property.class) || annotType.equals(Reference.class)
+ || annotType.equals(Resource.class)
+ || annotType.equals(Monitor.class)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java
new file mode 100644
index 0000000000..fd8df4e838
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegcal use of {@link org.osoa.sca.annotations.Callback} on a reference
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalCallbackReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = -8932525723147700591L;
+
+ public IllegalCallbackReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalCallbackReferenceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java
new file mode 100644
index 0000000000..9b548159db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Context}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalContextException extends IntrospectionException {
+ private static final long serialVersionUID = -6946383136750117008L;
+
+ public IllegalContextException(String message) {
+ super(message);
+ }
+
+ public IllegalContextException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java
new file mode 100644
index 0000000000..4e5620119b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Destroy}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalDestructorException extends IntrospectionException {
+ private static final long serialVersionUID = 365719353107446326L;
+
+ public IllegalDestructorException(String message) {
+ super(message);
+ }
+
+ public IllegalDestructorException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java
new file mode 100644
index 0000000000..bec7c29c54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal signature for a method decorated with {@link @org.osoa.sca.annotations.Init}
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalInitException extends IntrospectionException {
+ private static final long serialVersionUID = -3690763271986854701L;
+
+ public IllegalInitException(String message) {
+ super(message);
+ }
+
+ public IllegalInitException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java
new file mode 100644
index 0000000000..94ea3d1c0b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal reference definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = 4612984122225271395L;
+
+ public IllegalReferenceException(String message) {
+ super(message);
+ }
+
+ public IllegalReferenceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java
new file mode 100644
index 0000000000..44ba25c460
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal resource definition in a component type
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalResourceException extends IntrospectionException {
+ private static final long serialVersionUID = -1100936539412435579L;
+
+ public IllegalResourceException(String message) {
+ super(message);
+ }
+
+ public IllegalResourceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java
new file mode 100644
index 0000000000..14079b2b1d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an illegal use of the {@link @org.osoa.sca.annotations.Service} annotation
+ *
+ * @version $Rev$ $Date$
+ */
+public class IllegalServiceDefinitionException extends IntrospectionException {
+ private static final long serialVersionUID = -7151534258405092548L;
+
+ public IllegalServiceDefinitionException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
new file mode 100644
index 0000000000..0d2ac820a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * Processes the {@link @Init} annotation on a component implementation and
+ * updates the component type with the decorated initializer method
+ *
+ * @version $Rev$ $Date$
+ */
+public class InitProcessor extends BaseJavaClassVisitor {
+
+ public InitProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Init annotation = method.getAnnotation(Init.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 0) {
+ throw new IllegalInitException("Initializer must not have argments", method);
+ }
+ if (type.getInitMethod() != null) {
+ throw new DuplicateInitException("More than one initializer found on implementaton");
+ }
+ if (Modifier.isProtected(method.getModifiers())) {
+ method.setAccessible(true);
+ }
+ type.setInitMethod(method);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java
new file mode 100644
index 0000000000..0435cdee67
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an invalid constructor definition, e.g. when the number of injection names specified in {@link
+ * org.osoa.sca.annotations.Constructor} do not match the number of actual constructor parameters
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = 1411492435210741512L;
+
+ public InvalidConstructorException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
new file mode 100644
index 0000000000..fdc6f1dd34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Raised when an implementation specifies improper conversational metadata
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidConversationalImplementation extends IntrospectionException {
+ private static final long serialVersionUID = -5487291552769408149L;
+
+ public InvalidConversationalImplementation(String message) {
+ super(message);
+ }
+
+ public InvalidConversationalImplementation(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java
new file mode 100644
index 0000000000..dc1cc2e0e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Property}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidPropertyException extends IntrospectionException {
+ private static final long serialVersionUID = -2682862652069727948L;
+
+ public InvalidPropertyException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java
new file mode 100644
index 0000000000..79b81afcb7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link org.osoa.sca.annotations.Reference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidReferenceException extends IntrospectionException {
+ private static final long serialVersionUID = -3285246635989254165L;
+
+ public InvalidReferenceException(String message) {
+ super(message);
+ }
+
+ public InvalidReferenceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidReferenceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java
new file mode 100644
index 0000000000..1b47090e55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Denotes an invalid usage of {@link @org.apache.tuscany.api.annotation.Resource}
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidResourceException extends IntrospectionException {
+ private static final long serialVersionUID = 511728001735534934L;
+
+ public InvalidResourceException(String message) {
+ super(message);
+ }
+
+ public InvalidResourceException(String message, Member member) {
+ super(message, member);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
new file mode 100644
index 0000000000..a7e4b0d827
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when a service type specified by an {@link org.osoa.sca.annotations.Service} annotation is invalid, e.g. it is
+ * not an interface
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidServiceType extends IntrospectionException {
+ private static final long serialVersionUID = -1076466639416644386L;
+ private Class<?> serviceType;
+
+ public InvalidServiceType(String message) {
+ super(message);
+ }
+
+ public InvalidServiceType(String message, Class<?> clazz) {
+ super(message);
+ this.serviceType = clazz;
+ }
+
+ /**
+ * @return the serviceType
+ */
+ public Class<?> getServiceType() {
+ return serviceType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
new file mode 100644
index 0000000000..e0f1a0d52a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
@@ -0,0 +1,448 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.beans.Introspector;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Implements various reflection-related operations
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaIntrospectionHelper {
+
+ private static final Class[] EMPTY_CLASS_ARRY = new Class[0];
+
+ /**
+ * Hide the constructor
+ */
+ private JavaIntrospectionHelper() {
+ }
+
+ /**
+ * Returns a collection of public, and protected fields declared by a class
+ * or one of its supertypes
+ */
+ public static Set<Field> getAllPublicAndProtectedFields(Class clazz) {
+ return getAllPublicAndProtectedFields(clazz, new HashSet<Field>());
+ }
+
+ /**
+ * Recursively evaluates the type hierachy to return all fields that are
+ * public or protected
+ */
+ private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields) {
+ if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
+ return fields;
+ }
+ fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields);
+ Field[] declaredFields = clazz.getDeclaredFields();
+ for (Field field : declaredFields) {
+ int modifiers = field.getModifiers();
+ if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) {
+ field.setAccessible(true); // ignore Java accessibility
+ fields.add(field);
+ }
+ }
+ return fields;
+ }
+
+ /**
+ * Returns a collection of public and protected methods declared by a class
+ * or one of its supertypes. Note that overriden methods will not be
+ * returned in the collection (i.e. only the method override will be). <p/>
+ * This method can potentially be expensive as reflection information is not
+ * cached. It is assumed that this method will be used during a
+ * configuration phase.
+ */
+ public static Set<Method> getAllUniquePublicProtectedMethods(Class clazz) {
+ return getAllUniqueMethods(clazz, new HashSet<Method>());
+ }
+
+ /**
+ * Recursively evaluates the type hierarchy to return all unique methods
+ */
+ private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods) {
+ if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) {
+ return methods;
+ }
+ // we first evaluate methods of the subclass and then move to the parent
+ Method[] declaredMethods = pClass.getDeclaredMethods();
+ for (Method declaredMethod : declaredMethods) {
+ int modifiers = declaredMethod.getModifiers();
+ if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) {
+ continue;
+ }
+ if (methods.size() == 0) {
+ methods.add(declaredMethod);
+ } else {
+ List<Method> temp = new ArrayList<Method>();
+ boolean matched = false;
+ for (Method method : methods) {
+ // only add if not already in the set from a supclass (i.e.
+ // the
+ // method is not overrided)
+ if (exactMethodMatch(declaredMethod, method)) {
+ matched = true;
+ break;
+ }
+ }
+ if (!matched) {
+ // TODO ignore Java accessibility
+ declaredMethod.setAccessible(true);
+ temp.add(declaredMethod);
+ }
+ methods.addAll(temp);
+ temp.clear();
+ }
+ }
+ // evaluate class hierarchy - this is done last to track inherited
+ // methods
+ methods = getAllUniqueMethods(pClass.getSuperclass(), methods);
+ return methods;
+ }
+
+ /**
+ * Finds the closest matching field with the given name, that is, a field of
+ * the exact specified type or, alternately, of a supertype.
+ *
+ * @param name the name of the field
+ * @param type the field type
+ * @param fields the collection of fields to search
+ * @return the matching field or null if not found
+ */
+ public static Field findClosestMatchingField(String name, Class type, Set<Field> fields) {
+ Field candidate = null;
+ for (Field field : fields) {
+ if (field.getName().equals(name)) {
+ if (field.getType().equals(type)) {
+ return field; // exact match
+ } else if (field.getType().isAssignableFrom(type)
+ || (field.getType().isPrimitive() && primitiveAssignable(field.getType(), type))) {
+ // We could have the situation where a field parameter is a
+ // primitive and the demarshalled value is
+ // an object counterpart (e.g. Integer and int)
+ // @spec issue
+ // either an interface or super class, so keep a reference
+ // until
+ // we know there are no closer types
+ candidate = field;
+ }
+ }
+ }
+ if (candidate != null) {
+ return candidate;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Finds the closest matching method with the given name, that is, a method
+ * taking the exact parameter types or, alternately, parameter supertypes.
+ *
+ * @param name the name of the method
+ * @param types the method parameter types
+ * @param methods the collection of methods to search
+ * @return the matching method or null if not found
+ */
+ public static Method findClosestMatchingMethod(String name, Class[] types, Set<Method> methods) {
+ if (types == null) {
+ types = EMPTY_CLASS_ARRY;
+ }
+ Method candidate = null;
+ for (Method method : methods) {
+ if (method.getName().equals(name) && method.getParameterTypes().length == types.length) {
+ Class<?>[] params = method.getParameterTypes();
+ boolean disqualify = false;
+ boolean exactMatch = true;
+ for (int i = 0; i < params.length; i++) {
+ if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) {
+ // no match
+ disqualify = true;
+ exactMatch = false;
+ break;
+ } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) {
+ // not exact match
+ exactMatch = false;
+ }
+ }
+ if (disqualify) {
+ continue;
+ } else if (exactMatch) {
+ return method;
+ } else {
+ candidate = method;
+ }
+ }
+ }
+ if (candidate != null) {
+ return candidate;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Determines if two methods "match" - that is, they have the same method
+ * names and exact parameter types (one is not a supertype of the other)
+ */
+ public static boolean exactMethodMatch(Method method1, Method method2) {
+ if (!method1.getName().equals(method2.getName())) {
+ return false;
+ }
+ Class<?>[] types1 = method1.getParameterTypes();
+ Class<?>[] types2 = method2.getParameterTypes();
+ if (types1.length != types2.length) {
+ return false;
+ }
+ boolean matched = true;
+ for (int i = 0; i < types1.length; i++) {
+ if (types1[i] != types2[i]) {
+ matched = false;
+ break;
+ }
+ }
+ return matched;
+ }
+
+ public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws NoSuchMethodException {
+ return clazz.getConstructor((Class[])null);
+ }
+
+ /**
+ * Returns the simple name of a class - i.e. the class name devoid of its
+ * package qualifier
+ *
+ * @param implClass the implmentation class
+ */
+ public static String getBaseName(Class<?> implClass) {
+ return implClass.getSimpleName();
+ }
+
+ public static boolean isImmutable(Class clazz) {
+ return String.class == clazz || clazz.isPrimitive()
+ || Number.class.isAssignableFrom(clazz)
+ || Boolean.class.isAssignableFrom(clazz)
+ || Character.class.isAssignableFrom(clazz)
+ || Byte.class.isAssignableFrom(clazz);
+ }
+
+ /**
+ * Takes a property name and converts it to a getter method name according
+ * to JavaBean conventions. For example, property
+ * <code>foo<code> is returned as <code>getFoo</code>
+ */
+ public static String toGetter(String name) {
+ return "get" + name.toUpperCase().substring(0, 1) + name.substring(1);
+ }
+
+ /**
+ * Takes a setter or getter method name and converts it to a property name
+ * according to JavaBean conventions. For example, <code>setFoo(var)</code>
+ * is returned as property <code>foo<code>
+ */
+ public static String toPropertyName(String name) {
+ if (!name.startsWith("set")) {
+ return name;
+ }
+ return Introspector.decapitalize(name.substring(3));
+ }
+
+ public static Class<?> getErasure(Type type) {
+ if (type instanceof Class) {
+ return (Class)type;
+ } else if (type instanceof GenericArrayType) {
+ // FIXME: How to deal with the []?
+ GenericArrayType arrayType = (GenericArrayType)type;
+ return getErasure(arrayType.getGenericComponentType());
+ } else if (type instanceof ParameterizedType) {
+ ParameterizedType pType = (ParameterizedType)type;
+ return getErasure(pType.getRawType());
+ } else if (type instanceof WildcardType) {
+ WildcardType wType = (WildcardType)type;
+ Type[] types = wType.getUpperBounds();
+ return getErasure(types[0]);
+ } else if (type instanceof TypeVariable) {
+ TypeVariable var = (TypeVariable)type;
+ Type[] types = var.getBounds();
+ return getErasure(types[0]);
+ }
+ return null;
+ }
+
+ public static Class<?> getBaseType(Class<?> cls, Type genericType) {
+ if (cls.isArray()) {
+ return cls.getComponentType();
+ } else if (Collection.class.isAssignableFrom(cls)) {
+ if (genericType instanceof ParameterizedType) {
+ // Collection<BaseType>
+ ParameterizedType parameterizedType = (ParameterizedType)genericType;
+ Type baseType = parameterizedType.getActualTypeArguments()[0];
+ if (baseType instanceof GenericArrayType) {
+ // Base is array
+ return cls;
+ } else {
+ return getErasure(baseType);
+ }
+ } else {
+ return cls;
+ }
+ } else {
+ return cls;
+ }
+ }
+
+ /**
+ * Takes a property name and converts it to a setter method name according
+ * to JavaBean conventions. For example, the property
+ * <code>foo<code> is returned as <code>setFoo(var)</code>
+ */
+ public static String toSetter(String name) {
+ return "set" + name.toUpperCase().substring(0, 1) + name.substring(1);
+ }
+
+ /**
+ * Compares a two types, assuming one is a primitive, to determine if the
+ * other is its object counterpart
+ */
+ private static boolean primitiveAssignable(Class memberType, Class param) {
+ if (memberType == Integer.class) {
+ return param == Integer.TYPE;
+ } else if (memberType == Double.class) {
+ return param == Double.TYPE;
+ } else if (memberType == Float.class) {
+ return param == Float.TYPE;
+ } else if (memberType == Short.class) {
+ return param == Short.TYPE;
+ } else if (memberType == Character.class) {
+ return param == Character.TYPE;
+ } else if (memberType == Boolean.class) {
+ return param == Boolean.TYPE;
+ } else if (memberType == Byte.class) {
+ return param == Byte.TYPE;
+ } else if (param == Integer.class) {
+ return memberType == Integer.TYPE;
+ } else if (param == Double.class) {
+ return memberType == Double.TYPE;
+ } else if (param == Float.class) {
+ return memberType == Float.TYPE;
+ } else if (param == Short.class) {
+ return memberType == Short.TYPE;
+ } else if (param == Character.class) {
+ return memberType == Character.TYPE;
+ } else if (param == Boolean.class) {
+ return memberType == Boolean.TYPE;
+ } else if (param == Byte.class) {
+ return memberType == Byte.TYPE;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the generic types represented in the given type. Usage as
+ * follows: <code>
+ * JavaIntrospectionHelper.getGenerics(field.getGenericType());
+ * <p/>
+ * JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); </code>
+ *
+ * @return the generic types in order of declaration or an empty array if
+ * the type is not genericized
+ */
+ public static List<? extends Type> getGenerics(Type genericType) {
+ List<Type> classes = new ArrayList<Type>();
+ if (genericType instanceof ParameterizedType) {
+ ParameterizedType ptype = (ParameterizedType)genericType;
+ // get the type arguments
+ Type[] targs = ptype.getActualTypeArguments();
+ for (Type targ : targs) {
+ classes.add(targ);
+ }
+ }
+ return classes;
+ }
+
+ /**
+ * Returns the generic type specified by the class at the given position as
+ * in: <p/> <code> public class Foo<Bar,Baz>{ //.. }
+ * <p/>
+ * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); <code>
+ * <p/>
+ * will return Baz.
+ */
+ public static Class introspectGeneric(Class<?> clazz, int pos) {
+ assert clazz != null : "No class specified";
+ Type type = clazz.getGenericSuperclass();
+ if (type instanceof ParameterizedType) {
+ Type[] args = ((ParameterizedType)type).getActualTypeArguments();
+ if (args.length <= pos) {
+ throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName());
+ }
+ return (Class)((ParameterizedType)type).getActualTypeArguments()[pos];
+ } else {
+ Type[] interfaces = clazz.getGenericInterfaces();
+ for (Type itype : interfaces) {
+ if (!(itype instanceof ParameterizedType)) {
+ continue;
+ }
+ ParameterizedType interfaceType = (ParameterizedType)itype;
+ return (Class)interfaceType.getActualTypeArguments()[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the set of interfaces implemented by the given class and its
+ * ancestors or a blank set if none
+ */
+ public static Set<Class> getAllInterfaces(Class clazz) {
+ Set<Class> implemented = new HashSet<Class>();
+ getAllInterfaces(clazz, implemented);
+ return implemented;
+ }
+
+ private static void getAllInterfaces(Class clazz, Set<Class> implemented) {
+ Class[] interfaces = clazz.getInterfaces();
+ for (Class interfaze : interfaces) {
+ implemented.add(interfaze);
+ }
+ Class<?> superClass = clazz.getSuperclass();
+ // Object has no superclass so check for null
+ if (superClass != null && !superClass.equals(Object.class)) {
+ getAllInterfaces(superClass, implemented);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java
new file mode 100644
index 0000000000..2caa4b8bde
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when a suitable constructor for a component implementation cannot be found
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoConstructorException extends IntrospectionException {
+ private static final long serialVersionUID = 3086706387280694424L;
+
+ public NoConstructorException() {
+ }
+
+ public NoConstructorException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
new file mode 100644
index 0000000000..a674197b6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Callback;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.osoa.sca.annotations.Requires;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Requires} annotation
+ *
+ * @version $Rev:
+ */
+public class PolicyProcessor extends BaseJavaClassVisitor {
+
+ private PolicyFactory policyFactory;
+
+ public PolicyProcessor(AssemblyFactory assemblyFactory, PolicyFactory policyFactory) {
+ super(assemblyFactory);
+ this.policyFactory = policyFactory;
+ }
+
+ private QName getQName(String intentName) {
+ QName qname;
+ if (intentName.startsWith("{")) {
+ int i = intentName.indexOf('}');
+ if (i != -1) {
+ qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
+ } else {
+ qname = new QName("", intentName);
+ }
+ } else {
+ qname = new QName("", intentName);
+ }
+ return qname;
+ }
+
+ /**
+ * Read policy intents on the given interface or class
+ * @param clazz
+ * @param requiredIntents
+ */
+ private void readIntents(Class<?> clazz, List<Intent> requiredIntents) {
+ Requires intentAnnotation = clazz.getAnnotation(Requires.class);
+ if (intentAnnotation != null) {
+ String[] intentNames = intentAnnotation.value();
+ if (intentNames.length != 0) {
+ for (String intentName : intentNames) {
+
+ // Add each intent to the list
+ Intent intent = policyFactory.createIntent();
+ intent.setName(getQName(intentName));
+ requiredIntents.add(intent);
+ }
+ }
+ }
+ }
+
+ private void readIntents(Method method, List<Intent> requiredIntents) {
+ Requires intentAnnotation = method.getAnnotation(Requires.class);
+ if (intentAnnotation != null) {
+ String[] intentNames = intentAnnotation.value();
+ if (intentNames.length != 0) {
+ Operation operation = assemblyFactory.createOperation();
+ operation.setName(method.getName());
+ operation.setUnresolved(true);
+ for (String intentName : intentNames) {
+
+ // Add each intent to the list, associated with the
+ // operation corresponding to the annotated method
+ Intent intent = policyFactory.createIntent();
+ intent.setName(getQName(intentName));
+ intent.getOperations().add(operation);
+ requiredIntents.add(intent);
+ }
+ }
+ }
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+
+ // Read intents on the Java implementation class
+ readIntents(clazz, type.getRequiredIntents());
+
+ // Process annotations on the service interfaces
+ //TODO This will have to move to a JavaInterface introspector later
+ for (Service service: type.getServices()) {
+ InterfaceContract interfaceContract = service.getInterfaceContract();
+ if (interfaceContract instanceof JavaInterfaceContract) {
+ JavaInterfaceContract javaInterfaceContract = (JavaInterfaceContract)interfaceContract;
+
+ // Read intents on the service interface
+ if (javaInterfaceContract.getInterface() != null) {
+ JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+ if (javaInterface.getJavaClass() != null) {
+ readIntents(javaInterface.getJavaClass(), service.getRequiredIntents());
+
+ // Read intents on the service interface methods
+ Method[] methods = javaInterface.getJavaClass().getMethods();
+ for (Method method: methods) {
+ readIntents(method, service.getRequiredIntents());
+ }
+ }
+
+ }
+
+ // Read intents on the callback interface
+ if (javaInterfaceContract.getCallbackInterface() != null) {
+ JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+ if (javaCallbackInterface.getJavaClass() != null) {
+ Callback callback = service.getCallback();
+ if (callback == null) {
+ callback = assemblyFactory.createCallback();
+ service.setCallback(callback);
+ }
+ readIntents(javaCallbackInterface.getJavaClass(), callback.getRequiredIntents());
+
+ // Read intents on the callback interface methods
+ Method[] methods = javaCallbackInterface.getJavaClass().getMethods();
+ for (Method method: methods) {
+ readIntents(method, callback.getRequiredIntents());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+
+ // Read the intents specified on the given implementation method
+ readIntents(method, type.getRequiredIntents());
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java
new file mode 100644
index 0000000000..e3c7ad03df
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * Processes an {@link @Property} annotation, updating the component type with
+ * corresponding {@link JavaMappedProperty}
+ *
+ * @version $Rev$ $Date$
+ */
+public class PropertyProcessor extends AbstractPropertyProcessor<Property> {
+
+ public PropertyProcessor(AssemblyFactory assemblyFactory) {
+ super(assemblyFactory, Property.class);
+ }
+
+ protected String getName(Property annotation) {
+ return annotation.name();
+ }
+
+ protected void initProperty(org.apache.tuscany.sca.assembly.Property property, Property annotation) {
+ property.setMustSupply(annotation.required());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
new file mode 100644
index 0000000000..2bd6ce20ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collection;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * Processes an {@link @Reference} annotation, updating the component type with
+ * corresponding {@link
+ * org.apache.tuscany.spi.implementation.java.JavaMappedReference}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProcessor extends BaseJavaClassVisitor {
+ private JavaInterfaceIntrospector interfaceIntrospector;
+ private JavaInterfaceFactory javaFactory;
+
+ public ReferenceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory, JavaInterfaceIntrospector interfaceIntrospector) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ this.interfaceIntrospector = interfaceIntrospector;
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ Reference annotation = method.getAnnotation(Reference.class);
+ if (annotation == null) {
+ return; // Not a reference annotation.
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalReferenceException("Setter must have one parameter", method);
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ if (type.getReferenceMembers().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+
+ JavaElementImpl element = new JavaElementImpl(method, 0);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, element);
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+ Reference annotation = field.getAnnotation(Reference.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if ("".equals(name)) {
+ name = field.getName();
+ }
+ if (type.getReferenceMembers().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+ JavaElementImpl element = new JavaElementImpl(field);
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, element);
+ }
+
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+ Reference refAnnotation = parameter.getAnnotation(Reference.class);
+ if (refAnnotation == null) {
+ return;
+ }
+ String paramName = parameter.getName();
+ String name = getReferenceName(paramName, parameter.getIndex(), refAnnotation.name());
+ if (type.getReferenceMembers().get(name) != null) {
+ throw new DuplicateReferenceException(name);
+ }
+ org.apache.tuscany.sca.assembly.Reference reference = createReference(parameter, name);
+ type.getReferences().add(reference);
+ type.getReferenceMembers().put(name, parameter);
+ parameter.setClassifer(Reference.class);
+ parameter.setName(name);
+ }
+
+ private String getReferenceName(String paramName, int pos, String name) throws InvalidConstructorException {
+ if ("".equals(name)) {
+ name = paramName;
+ }
+ if ("".equals(name)) {
+ return "_ref" + pos;
+ }
+ if (!"".equals(paramName) && !name.equals(paramName)) {
+ throw new InvalidConstructorException("Mismatching names specified for reference parameter " + pos);
+ } else {
+ return name;
+ }
+ }
+
+ private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name) throws IntrospectionException {
+ org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ reference.setInterfaceContract(interfaceContract);
+
+ // reference.setMember((Member)element.getAnchor());
+ boolean required = true;
+ Reference ref = element.getAnnotation(Reference.class);
+ if (ref != null) {
+ required = ref.required();
+ }
+ // reference.setRequired(required);
+ reference.setName(name);
+ Class<?> rawType = element.getType();
+ if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_N);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_N);
+ }
+ } else {
+ if (required) {
+ reference.setMultiplicity(Multiplicity.ONE_ONE);
+ } else {
+ reference.setMultiplicity(Multiplicity.ZERO_ONE);
+ }
+ }
+ Type genericType = element.getGenericType();
+ Class<?> baseType = getBaseType(rawType, genericType);
+ try {
+ JavaInterface callInterface = interfaceIntrospector.introspect(baseType);
+ reference.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ return reference;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
new file mode 100644
index 0000000000..2930e5f8d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Processes an {@link @Resource} annotation, updating the component type with
+ * corresponding {@link org.apache.tuscany.spi.implementation.java.JavaResourceImpl}
+ *
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessor extends BaseJavaClassVisitor {
+
+ public ResourceProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+ org.apache.tuscany.api.annotation.Resource annotation = method
+ .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalResourceException("Resource setter must have one parameter", method);
+ }
+ String name = annotation.name();
+ if (name.length() < 1) {
+ name = JavaIntrospectionHelper.toPropertyName(method.getName());
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = annotation.mappedName();
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
+ resource.setOptional(annotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ org.apache.tuscany.api.annotation.Resource annotation = field
+ .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ if (annotation == null) {
+ return;
+ }
+ String name = annotation.name();
+ if (name.length() < 1) {
+ name = field.getName();
+ }
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = annotation.mappedName();
+
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(field));
+ resource.setOptional(annotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+
+ @SuppressWarnings("unchecked")
+ public JavaResourceImpl createResource(String name, JavaElementImpl element) {
+ element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+ element.setName(name);
+ return new JavaResourceImpl(element);
+ }
+
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
+ throws IntrospectionException {
+ org.apache.tuscany.api.annotation.Resource resourceAnnotation = parameter
+ .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+ if (resourceAnnotation != null) {
+ String name = resourceAnnotation.name();
+ if ("".equals(name)) {
+ name = parameter.getName();
+ }
+ if ("".equals(name)) {
+ throw new InvalidResourceException("Missing resource name", (Member)parameter.getAnchor());
+ }
+
+ if (!"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
+ throw new InvalidConstructorException("Mismatched resource name: " + parameter);
+ }
+
+ if (type.getResources().get(name) != null) {
+ throw new DuplicateResourceException(name);
+ }
+
+ String mappedName = resourceAnnotation.mappedName();
+
+ JavaResourceImpl resource = createResource(name, parameter);
+ resource.setOptional(resourceAnnotation.optional());
+ if (mappedName.length() > 0) {
+ resource.setMappedName(mappedName);
+ }
+ type.getResources().put(resource.getName(), resource);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java
new file mode 100644
index 0000000000..592a65b4b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Processes the {@link JavaScopeImpl} annotation and updates the component type with the corresponding implmentation scope
+ *
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessor extends BaseJavaClassVisitor {
+
+ public ScopeProcessor(AssemblyFactory factory) {
+ super(factory);
+ }
+
+ public <T> void visitClass(Class<T> clazz,
+ JavaImplementation type)
+ throws IntrospectionException {
+ org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
+ if (annotation == null) {
+ type.setJavaScope(JavaScopeImpl.STATELESS);
+ return;
+ }
+ String name = annotation.value();
+ JavaScopeImpl scope;
+ if ("COMPOSITE".equals(name)) {
+ scope = JavaScopeImpl.COMPOSITE;
+ } else if ("SESSION".equals(name)) {
+ scope = JavaScopeImpl.SESSION;
+ } else if ("CONVERSATION".equals(name)) {
+ scope = JavaScopeImpl.CONVERSATION;
+ } else if ("REQUEST".equals(name)) {
+ scope = JavaScopeImpl.REQUEST;
+ } else {
+ scope = new JavaScopeImpl(name);
+ }
+ type.setJavaScope(scope);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
new file mode 100644
index 0000000000..0ca1aefba0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Processes an {@link org.osoa.sca.annotations.Service} annotation and updates
+ * the component type with corresponding {@link Service}s. Also processes
+ * related {@link org.osoa.sca.annotations.Callback} annotations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessor extends BaseJavaClassVisitor {
+ private JavaInterfaceIntrospector interfaceIntrospector;
+ private JavaInterfaceFactory javaFactory;
+
+ public ServiceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory, JavaInterfaceIntrospector interfaceIntrospector) {
+ super(assemblyFactory);
+ this.javaFactory = javaFactory;
+ this.interfaceIntrospector = interfaceIntrospector;
+ }
+
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ org.osoa.sca.annotations.Service annotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
+ if (annotation == null) {
+ // scan intefaces for remotable
+ Set<Class> interfaces = getAllInterfaces(clazz);
+ for (Class<?> interfaze : interfaces) {
+ if (interfaze.isAnnotationPresent(Remotable.class) || interfaze.isAnnotationPresent(Callback.class)) {
+ Service service;
+ try {
+ service = createService(interfaze);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ type.getServices().add(service);
+ }
+ }
+ return;
+ }
+ Class<?>[] interfaces = annotation.interfaces();
+ if (interfaces.length == 0) {
+ Class<?> interfaze = annotation.value();
+ if (Void.class.equals(interfaze)) {
+ throw new IllegalServiceDefinitionException("No interfaces specified");
+ } else {
+ interfaces = new Class<?>[1];
+ interfaces[0] = interfaze;
+ }
+ }
+ for (Class<?> interfaze : interfaces) {
+ if (!interfaze.isInterface()) {
+ throw new InvalidServiceType("Service must be an interface", interfaze);
+ }
+ Service service;
+ try {
+ service = createService(interfaze);
+ } catch (InvalidInterfaceException e) {
+ throw new IntrospectionException(e);
+ }
+ type.getServices().add(service);
+ }
+ }
+
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = method.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ if (method.getParameterTypes().length != 1) {
+ throw new IllegalCallbackReferenceException("Setter must have one parameter", method);
+ }
+ Service callbackService = null;
+ Class<?> callbackClass = method.getParameterTypes()[0];
+ for (Service service : type.getServices()) {
+ JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
+ if (callbackClass == javaInterface.getJavaClass()) {
+ callbackService = service;
+ }
+ }
+ if (callbackService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
+ }
+ type.getCallbackMembers().put(callbackClass.getName(), new JavaElementImpl(method, 0));
+ }
+
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+
+ Callback annotation = field.getAnnotation(Callback.class);
+ if (annotation == null) {
+ return;
+ }
+ Service callbackService = null;
+ Class<?> callbackClass = field.getType();
+ for (Service service : type.getServices()) {
+ JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
+ if (callbackClass == javaInterface.getJavaClass()) {
+ callbackService = service;
+ }
+ }
+ if (callbackService == null) {
+ throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
+ }
+ type.getCallbackMembers().put(callbackClass.getName(), new JavaElementImpl(field));
+ }
+
+ public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+ Service service = assemblyFactory.createService();
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ service.setInterfaceContract(interfaceContract);
+
+ // create a relative URI
+ service.setName(interfaze.getSimpleName());
+
+ JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+ service.getInterfaceContract().setInterface(callInterface);
+ if (callInterface.getCallbackClass() != null) {
+ JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ service.getInterfaceContract().setCallbackInterface(callbackInterface);
+ }
+ return service;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java
new file mode 100644
index 0000000000..30b9af2ed5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+
+/**
+ * Thrown when a service interface cannot be determined based on a heuristic evaluation of an implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceTypeNotFoundException extends IntrospectionException {
+ private static final long serialVersionUID = -5124437274726947007L;
+
+ public ServiceTypeNotFoundException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java
new file mode 100644
index 0000000000..57d224b2bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.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.implementation.java.introspect.impl;
+
+/**
+ * Thrown when a method or field marked with {@link org.osoa.sca.annotations.Context} takes an unknown type
+ *
+ * @version $Rev$ $Date$
+ */
+public class UnknownContextTypeException extends IllegalContextException {
+ private static final long serialVersionUID = 8125863714365422419L;
+
+ public UnknownContextTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java
new file mode 100644
index 0000000000..0e14a2a689
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.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.implementation.java.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface JavaImplementationConstants {
+
+ String IMPLEMENTATION_JAVA = "implementation.java";
+ QName IMPLEMENTATION_JAVA_QNAME = new QName(Constants.SCA10_NS, "implementation.java");
+ String CLASS = "class";
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
new file mode 100644
index 0000000000..e702a3f682
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+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.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+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.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+public class JavaImplementationProcessor implements
+ StAXArtifactProcessor<JavaImplementation>, JavaImplementationConstants {
+
+ private JavaImplementationFactory javaFactory;
+ private JavaClassIntrospector introspector;
+ private AssemblyFactory assemblyFactory;
+ private PolicyFactory policyFactory;
+
+ public JavaImplementationProcessor(AssemblyFactory assemblyFactory,
+ PolicyFactory policyFactory,
+ JavaImplementationFactory javaFactory,
+ JavaClassIntrospector introspector) {
+ this.assemblyFactory = assemblyFactory;
+ this.policyFactory = policyFactory;
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException {
+
+ try {
+
+ // Read an <implementation.java>
+ JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
+ javaImplementation.setUnresolved(true);
+ javaImplementation.setName(reader.getAttributeValue(null, CLASS));
+
+ // Read policies
+ readPolicies(javaImplementation, reader);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return javaImplementation;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write an <interface.java>
+ writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
+ if (javaImplementation.getName() != null) {
+ writer.writeAttribute(CLASS, javaImplementation.getName());
+ }
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ public void resolve(JavaImplementation javaImplementation, ModelResolver resolver)
+ throws ContributionResolveException {
+
+ ClassReference classReference = new ClassReference(javaImplementation.getName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
+ }
+ javaImplementation.setJavaClass(javaClass);
+ javaImplementation.setUnresolved(false);
+
+ try {
+ introspector.introspect(javaImplementation.getJavaClass(), javaImplementation);
+ } catch (IntrospectionException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ // FIXME the introspector should always create at least one service
+ if (javaImplementation.getServices().isEmpty()) {
+ javaImplementation.getServices().add(assemblyFactory.createService());
+ }
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_JAVA_QNAME;
+ }
+
+ public Class<JavaImplementation> getModelType() {
+ return JavaImplementation.class;
+ }
+
+ /**
+ * Reads policy intents and policy sets.
+ * @param attachPoint
+ * @param reader
+ */
+ private void readPolicies(PolicySetAttachPoint attachPoint, XMLStreamReader reader) {
+ String value = reader.getAttributeValue(null, Constants.REQUIRES);
+ if (value != null) {
+ List<Intent> requiredIntents = attachPoint.getRequiredIntents();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ Intent intent = policyFactory.createIntent();
+ intent.setName(qname);
+ requiredIntents.add(intent);
+ }
+ }
+
+ value = reader.getAttributeValue(null, Constants.POLICY_SETS);
+ if (value != null) {
+ List<PolicySet> policySets = attachPoint.getPolicySets();
+ for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
+ QName qname = getQNameValue(reader, tokens.nextToken());
+ PolicySet policySet = policyFactory.createPolicySet();
+ policySet.setName(qname);
+ policySets.add(policySet);
+ }
+ }
+ }
+
+ /**
+ * Returns a qname from a string.
+ * @param reader
+ * @param value
+ * @return
+ */
+ private QName getQNameValue(XMLStreamReader reader, String value) {
+ if (value != null) {
+ int index = value.indexOf(':');
+ String prefix = index == -1 ? "" : value.substring(0, index);
+ String localName = index == -1 ? value : value.substring(index + 1);
+ String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddService.java
new file mode 100644
index 0000000000..4eeb30a9c2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..ea3e5341d5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.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;
+
+import org.osoa.sca.annotations.EagerInit;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Add service
+ */
+@Scope("COMPOSITE")
+@EagerInit
+public class AddServiceImpl implements AddService {
+
+ public double add(double n1, double n2) {
+ return n1 + n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.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 calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..11e8974657
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Calculator service.
+ */
+@Scope("COMPOSITE")
+public class CalculatorServiceImpl implements CalculatorService {
+
+ private AddService addService;
+ private SubtractService subtractService;
+ private MultiplyService multiplyService;
+ private DivideService divideService;
+
+ @Reference
+ public void setAddService(AddService addService) {
+ this.addService = addService;
+ }
+
+ @Reference
+ public void setSubtractService(SubtractService subtractService) {
+ this.subtractService = subtractService;
+ }
+
+ @Reference
+ public void setDivideService(DivideService divideService) {
+ this.divideService = divideService;
+ }
+
+ @Reference
+ public void setMultiplyService(MultiplyService multiplyService) {
+ this.multiplyService = multiplyService;
+ }
+
+ public double add(double n1, double n2) {
+ return addService.add(n1, n2);
+ }
+
+ public double subtract(double n1, double n2) {
+ return subtractService.subtract(n1, n2);
+ }
+
+ public double multiply(double n1, double n2) {
+ return multiplyService.multiply(n1, n2);
+ }
+
+ public double divide(double n1, double n2) {
+ return divideService.divide(n1, n2);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
new file mode 100644
index 0000000000..131c5a8014
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..9c7e96a668
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Divide service.
+ */
+@Scope("COMPOSITE")
+public class DivideServiceImpl implements DivideService {
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..a917896aeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..4892481203
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the Multiply service.
+ */
+@Scope("COMPOSITE")
+public class MultiplyServiceImpl implements MultiplyService {
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..e328f024ea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..ee1d7c3457
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.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 calculator;
+
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * An implementation of the subtract service.
+ */
+@Scope("COMPOSITE")
+public class SubtractServiceImpl implements SubtractService {
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java
new file mode 100644
index 0000000000..9ecd439611
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.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.implementation.java.introspect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaClassIntrospectorTestCase extends TestCase {
+
+ public void testRegister() throws Exception {
+ DefaultJavaClassIntrospectorExtensionPoint visitors = new DefaultJavaClassIntrospectorExtensionPoint();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ visitors.addClassVisitor(extension);
+ }
+
+ public void testUnegister() throws Exception {
+ DefaultJavaClassIntrospectorExtensionPoint visitors = new DefaultJavaClassIntrospectorExtensionPoint();
+ JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
+ visitors.addClassVisitor(extension);
+ visitors.removeClassVisitor(extension);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testWalk() throws Exception {
+ DefaultJavaClassIntrospectorExtensionPoint visitors = new DefaultJavaClassIntrospectorExtensionPoint();
+ JavaClassVisitor extension = EasyMock.createMock(JavaClassVisitor.class);
+ extension.visitClass(EasyMock.eq(Bar.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitConstructor(EasyMock.isA(Constructor.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitMethod(EasyMock.isA(Method.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitField(EasyMock.isA(Field.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitSuperClass(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitEnd(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
+
+ // mock.expects(once()).method("visitClass");
+ // mock.expects(once()).method("visitMethod");
+ // mock.expects(once()).method("visitField");
+ // mock.expects(once()).method("visitConstructor");
+ // mock.expects(once()).method("visitSuperClass");
+ // mock.expects(once()).method("visitEnd");
+ EasyMock.replay(extension);
+ visitors.addClassVisitor(extension);
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ ExtensibleJavaClassIntrospector introspector = new ExtensibleJavaClassIntrospector(visitors);
+ introspector.introspect(Bar.class, javaImplementationFactory.createJavaImplementation());
+ EasyMock.verify(extension);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ private class Baz {
+
+ }
+
+ private class Bar extends Baz {
+
+ protected String bar;
+
+ public Bar() {
+ }
+
+ public void bar() {
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java
new file mode 100644
index 0000000000..adefc4f7fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+
+
+/**
+ * Base class to simulate the processor sequences
+ *
+ * @version $Rev$ $Date$
+ */
+public class AbstractProcessorTest extends TestCase {
+ protected AssemblyFactory factory;
+ protected JavaInterfaceFactory javaFactory;
+ protected ConstructorProcessor constructorProcessor;
+ private ReferenceProcessor referenceProcessor;
+ private PropertyProcessor propertyProcessor;
+ private ResourceProcessor resourceProcessor;
+
+
+ protected AbstractProcessorTest() {
+ factory = new DefaultAssemblyFactory();
+ javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory, new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors));
+ propertyProcessor = new PropertyProcessor(factory);
+ resourceProcessor = new ResourceProcessor(factory);
+ constructorProcessor = new ConstructorProcessor(factory);
+ referenceProcessor = new ReferenceProcessor(factory, javaFactory, new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors));
+ propertyProcessor = new PropertyProcessor(factory);
+ }
+
+ protected <T> void visitConstructor(Constructor<T> constructor,
+ JavaImplementation type) throws IntrospectionException {
+ constructorProcessor.visitConstructor(constructor, type);
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ if (definition == null) {
+ definition = new JavaConstructorImpl<T>(constructor);
+ type.getConstructors().put(constructor, definition);
+ }
+ JavaParameterImpl[] parameters = definition.getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ resourceProcessor.visitConstructorParameter(parameters[i], type);
+ // monitorProcessor.visitConstructorParameter(parameters[i], type);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
new file mode 100644
index 0000000000..df316b3623
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.annotation.Retention;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.DuplicatePropertyException;
+import org.apache.tuscany.sca.implementation.java.introspect.IllegalPropertyException;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AbstractPropertyProcessorTestCase extends TestCase {
+
+ private JavaClassVisitor extension;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitMethod(method, type);
+ Property prop = getProperty(type, "test");
+ assertNotNull(prop);
+ }
+
+ public void testVisitNoParamsMethod() throws Exception {
+ Method method = Foo.class.getMethod("setNoParamsBar");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testVisitNonVoidMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBadBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitMethod(method, type);
+ try {
+ extension.visitMethod(method, type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("d");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ extension.visitField(field, type);
+ Property prop = getProperty(type, "test");
+ assertNotNull(prop);
+ }
+
+ public void testVisitConstructor() throws Exception {
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ JavaConstructorImpl<Foo> def = new JavaConstructorImpl<Foo>(ctor);
+ JavaParameterImpl parameter = def.getParameters()[0];
+ extension.visitConstructorParameter(parameter, type);
+ assertEquals("test", def.getParameters()[0].getName());
+ assertNotNull(getProperty(type, "test"));
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ super.setUp();
+ extension = new TestProcessor();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ @Retention(RUNTIME)
+ private @interface Bar {
+
+ }
+
+ private class TestProcessor extends AbstractPropertyProcessor<Bar> {
+
+ public TestProcessor() {
+ super(new DefaultAssemblyFactory(), Bar.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected void initProperty(Property property, Bar annotation) {
+ // property.setDefaultValueFactory(EasyMock.createMock(ObjectFactory.class));
+ property.setName("test");
+ }
+
+ protected String getName(Bar annotation) {
+ return "test";
+ }
+ }
+
+ private static class Foo {
+
+ @Bar
+ protected String d;
+
+ public Foo(String a, @Bar
+ String b) {
+ }
+
+ public Foo(@Bar
+ String d) {
+ this.d = d;
+ }
+
+ @Bar
+ public void setBar(String d) {
+ this.d = d;
+ }
+
+ @Bar
+ public void setNoParamsBar() {
+ }
+
+ @Bar
+ public String setBadBar(String d) {
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..9b3437b07a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.AllowsPassByReference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AllowsPassByReferenceProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ AllowsPassByReferenceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testClassAnnotation() throws Exception {
+ processor.visitClass(Foo.class, type);
+ assertEquals(true, type.isAllowsPassByReference());
+
+ processor.visitClass(Bar.class, type);
+ assertEquals(false, type.isAllowsPassByReference());
+
+ Method m1 = Bar.class.getMethod("m1", new Class[] {});
+ processor.visitMethod(m1, type);
+ assertTrue(type.isAllowsPassByReference(m1));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new AllowsPassByReferenceProcessor(new DefaultAssemblyFactory());
+ }
+
+ @AllowsPassByReference
+ private class Foo {
+ }
+
+ // no annotation
+ private class Bar {
+ @AllowsPassByReference
+ public void m1() {
+
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
new file mode 100644
index 0000000000..ce236c1d10
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorProcessorTestCase extends TestCase {
+ private ConstructorProcessor processor = new ConstructorProcessor(new DefaultAssemblyFactory());
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testDuplicateConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFoo.class, type);
+ fail();
+ } catch (DuplicateConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
+ processor.visitConstructor(ctor1, type);
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ public void testNoAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
+ processor.visitConstructor(ctor1, type);
+ assertNull(type.getConstructor());
+ }
+
+ public void testBadAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
+ try {
+ processor.visitConstructor(ctor1, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testMixedParameters() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.class, String.class);
+ processor.visitConstructor(ctor1, type);
+
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory, new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors));
+ PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ }
+
+ assertEquals("_ref0", parameters[0].getName());
+ assertEquals("foo", parameters[1].getName());
+ assertEquals("bar", parameters[2].getName());
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor("foo")
+ public BadFoo(String foo) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor( {"foo", "bar"})
+ public BadFoo(String foo, String bar) {
+
+ }
+ }
+
+ private static class Foo {
+ @org.osoa.sca.annotations.Constructor("foo")
+ public Foo(String foo) {
+
+ }
+ }
+
+ private static class NoAnnotation {
+ public NoAnnotation() {
+ }
+ }
+
+ private static class BadAnnotation {
+ @org.osoa.sca.annotations.Constructor("foo")
+ public BadAnnotation(String foo, Foo ref) {
+ }
+ }
+
+ public static final class Mixed {
+ @org.osoa.sca.annotations.Constructor
+ public Mixed(@Reference
+ String param1, @Property(name = "foo")
+ String param2, @Reference(name = "bar")
+ String param3) {
+ }
+ }
+
+ public static final class Multiple {
+ @org.osoa.sca.annotations.Constructor
+ public Multiple(@Reference
+ Collection<String> param1, @Property(name = "foo")
+ String[] param2, @Reference(name = "bar", required = true)
+ List<String> param3, @Property(name = "abc")
+ Set<String> param4, @Reference(name = "xyz")
+ String[] param5) {
+ }
+ }
+
+ public void testMultiplicity() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Multiple> ctor1 = Multiple.class.getConstructor(Collection.class,
+ String[].class,
+ List.class,
+ Set.class,
+ String[].class);
+ processor.visitConstructor(ctor1, type);
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory, new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors));
+ PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
+ for (int i = 0; i < parameters.length; i++) {
+ referenceProcessor.visitConstructorParameter(parameters[i], type);
+ propertyProcessor.visitConstructorParameter(parameters[i], type);
+ }
+
+ org.apache.tuscany.sca.assembly.Reference ref0 = getReference(type, "_ref0");
+ assertNotNull(ref0);
+ assertEquals(Multiplicity.ONE_N, ref0.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Reference ref1 = getReference(type, "bar");
+ assertNotNull(ref1);
+ assertEquals(Multiplicity.ONE_N, ref1.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Reference ref2 = getReference(type, "xyz");
+ assertNotNull(ref2);
+ assertEquals(Multiplicity.ONE_N, ref2.getMultiplicity());
+ org.apache.tuscany.sca.assembly.Property prop1 = getProperty(type, "foo");
+ assertNotNull(prop1);
+ assertTrue(prop1.isMany());
+ org.apache.tuscany.sca.assembly.Property prop2 = getProperty(type, "abc");
+ assertNotNull(prop2);
+ assertTrue(prop2.isMany());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
new file mode 100644
index 0000000000..aef565b3e4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
@@ -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.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.DuplicatePropertyException;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorPropertyTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.assembly.Property property = getProperty(type, "myProp");
+ assertTrue(property.isMustSupply());
+ assertEquals("myProp", property.getName());
+ }
+
+ public void testTwoPropertiesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getProperty(type, "myProp1"));
+ assertNotNull(getProperty(type, "myProp2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidPropertyException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getProperty(type, "myProp"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+// public void testMultiplicityRequired() throws Exception {
+ // TODO multiplicity
+// }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property(name = "myProp", required = true)String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public Foo(@Property Integer prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property(name = "myProp1")String prop1, @Property(name = "myProp2")String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Property List prop) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public BadFoo(@Property(name = "myProp")String prop1, @Property(name = "myProp")String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public BadFoo(@Property String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public BadFoo(@Property Integer prop, @Property Integer prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
+ public BadFoo(@Property List ref, @Property(name = "myOtherRef")List ref2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
new file mode 100644
index 0000000000..9d4204d114
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorReferenceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "myRef");
+ assertEquals(Multiplicity.ONE_ONE, reference.getMultiplicity());
+ assertEquals("myRef", reference.getName());
+ }
+
+ public void testTwoReferencesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "myRef1"));
+ assertNotNull(getReference(type, "myRef2"));
+ }
+
+ public void testDuplicateProperty() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<NoNameFoo> ctor = NoNameFoo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "_ref0"));
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(getReference(type, "myRef"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+// public void testMultiplicityRequired() throws Exception {
+ // TODO multiplicity
+// }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference(name = "myRef", required = true)String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference(name = "myRef1")String prop1, @Reference(name = "myRef2")String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myRef")
+ public Foo(@Reference Integer prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor()
+ public Foo(@Reference List prop) {
+
+ }
+ }
+
+ private static class NoNameFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public NoNameFoo(@Reference String prop) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Reference(name = "myRef")String prop1, @Reference(name = "myRef")String prop2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Reference String prop) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myRef")
+ public BadFoo(@Reference Integer ref, @Reference Integer ref2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
+ public BadFoo(@Reference List ref, @Reference(name = "myOtherRef")List ref2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
new file mode 100644
index 0000000000..2e56a2a812
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.List;
+
+import org.apache.tuscany.api.annotation.Resource;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConstructorResourceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testResource() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
+ visitConstructor(ctor, type);
+ org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl resource = type.getResources().get("myResource");
+ assertFalse(resource.isOptional());
+ }
+
+ public void testTwoResourcesSameType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ visitConstructor(ctor, type);
+ assertNotNull(type.getResources().get("myResource1"));
+ assertNotNull(type.getResources().get("myResource2"));
+ }
+
+ public void testDuplicateResource() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (DuplicateResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNoName() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(String.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidResourceException e) {
+ // expected
+ }
+ }
+
+ public void testNamesOnConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
+ visitConstructor(ctor, type);
+ assertNotNull(type.getResources().get("myResource"));
+ }
+
+ public void testInvalidNumberOfNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(Integer.class, Integer.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testNoMatchingNames() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ConstructorResourceTestCase.BadFoo> ctor =
+ ConstructorResourceTestCase.BadFoo.class.getConstructor(List.class, List.class);
+ try {
+ visitConstructor(ctor, type);
+ fail();
+ } catch (InvalidConstructorException e) {
+ // expected
+ }
+ }
+
+ private static class Foo {
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource(name = "myResource") String resource) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myResource")
+ public Foo(@Resource Integer resource) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource(name = "myResource1") String res1, @Resource(name = "myResource2") String res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public Foo(@Resource List res) {
+
+ }
+ }
+
+ private static class BadFoo {
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Resource(name = "myResource") String res1, @Resource(name = "myResource") String res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor
+ public BadFoo(@Resource String res) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor("myProp")
+ public BadFoo(@Resource Integer res, @Resource Integer res2) {
+
+ }
+
+ @org.osoa.sca.annotations.Constructor({"myRes", "myRes2"})
+ public BadFoo(@Resource List res, @Resource(name = "myOtherRes") List res2) {
+
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
new file mode 100644
index 0000000000..5f0e189f69
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.easymock.EasyMock;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.Context;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContextProcessorTestCase extends TestCase {
+ private ContextProcessor processor;
+ private Component composite;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ // FIXME: resurrect to test ComponentContext injection
+/*
+ public void testCompositeContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class);
+ JavaImplementationDefinition type =
+ new JavaImplementationDefinition();
+ processor.visitMethod(composite, method, type);
+ assertNotNull(type.getResources().get("context"));
+ }
+*/
+
+ // FIXME: resurrect to test ComponentContext injection
+/*
+ public void testCompositeContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("context");
+ JavaImplementationDefinition type =
+ new JavaImplementationDefinition();
+ processor.visitField(composite, field, type);
+ assertNotNull(type.getResources().get("context"));
+ }
+*/
+
+ public void testRequestContextMethod() throws Exception {
+ Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testRequestContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("requestContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertNotNull(type.getResources().get("requestContext"));
+ }
+
+ public void testInvalidParamType() throws Exception {
+ Method method = Foo.class.getMethod("setContext", String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidParamTypeField() throws Exception {
+ Field field = Foo.class.getDeclaredField("badContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (UnknownContextTypeException e) {
+ // expected
+ }
+ }
+
+
+ public void testInvalidParamNum() throws Exception {
+ Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidNoParams() throws Exception {
+ Method method = Foo.class.getMethod("setContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalContextException e) {
+ // expected
+ }
+ }
+
+ public void testNoContext() throws Exception {
+ Method method = Foo.class.getMethod("noContext", ComponentContext.class);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitMethod(method, type);
+ assertEquals(0, type.getResources().size());
+ }
+
+ public void testNoContextField() throws Exception {
+ Field field = Foo.class.getDeclaredField("noContext");
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitField(field, type);
+ assertEquals(0, type.getResources().size());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ processor = new ContextProcessor(new DefaultAssemblyFactory());
+ // processor.setWorkContext(EasyMock.createNiceMock(WorkContext.class));
+ composite = EasyMock.createNiceMock(Component.class);
+ }
+
+ private class Foo {
+ @Context
+ protected ComponentContext context;
+
+ @Context
+ protected Object badContext;
+
+ protected ComponentContext noContext;
+
+ @Context
+ protected RequestContext requestContext;
+
+ @Context
+ public void setContext(ComponentContext context) {
+
+ }
+
+ @Context
+ public void setContext(String context) {
+
+ }
+
+ @Context
+ public void setContext(ComponentContext context, String string) {
+
+ }
+
+ @Context
+ public void setContext() {
+
+ }
+
+ public void noContext(ComponentContext context) {
+
+ }
+
+ @Context
+ public void setRequestContext(RequestContext requestContext) {
+ this.requestContext = requestContext;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
new file mode 100644
index 0000000000..239012d468
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.ConversationAttributes;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationProcessorTestCase extends TestCase {
+ private ConversationProcessor processor = new ConversationProcessor(new DefaultAssemblyFactory());
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testMaxIdleTime() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooMaxIdle.class, type);
+ assertEquals(10000L, type.getMaxIdleTime());
+ assertEquals(-1, type.getMaxAge());
+ }
+
+ public void testMaxAge() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooMaxAge.class, type);
+ assertEquals(10000L, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testBadFooBoth() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooBoth.class, type);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+
+ public void testImplicitScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(ImplicitFooScope.class, type);
+ assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ }
+
+ public void testBadFooScope() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooScope.class, type);
+ fail();
+ } catch (InvalidConversationalImplementation e) {
+ // expected
+ }
+ }
+
+ public void testJustConversation() throws Exception {
+ // TODO do we want these semantics
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooJustConversation.class, type);
+ assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ assertEquals(-1, type.getMaxAge());
+ assertEquals(-1, type.getMaxIdleTime());
+ }
+
+ public void testSetConversationIDField() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Field field = FooWithConversationIDField.class.getDeclaredField("conversationID");
+ processor.visitField(field, type);
+ assertNotNull(type.getConversationIDMember());
+ assertEquals(field, type.getConversationIDMember());
+ }
+
+ public void testSetConversationIDMethod() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
+ processor.visitMethod(method, type);
+ assertNotNull(type.getConversationIDMember());
+ assertEquals(method, type.getConversationIDMember());
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxIdleTime = "10 seconds")
+ private class FooMaxIdle {
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class FooMaxAge {
+ }
+
+ @Scope("CONVERSATION")
+ @ConversationAttributes(maxAge = "10 seconds", maxIdleTime = "10 seconds")
+ private class BadFooBoth {
+ }
+
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class ImplicitFooScope {
+ }
+
+ @Scope("STATELESS")
+ @ConversationAttributes(maxAge = "10 seconds")
+ private class BadFooScope {
+ }
+
+ @ConversationAttributes
+ private class FooJustConversation {
+ }
+
+ private class FooWithConversationIDField {
+ @ConversationID
+ private String conversationID;
+ }
+
+ private class FooWithConversationIDMethod {
+ @ConversationID
+ void setConversationID(String conversationID) {
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
new file mode 100644
index 0000000000..1c00df8e04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConvertTimeMillisTestCase extends TestCase {
+ private MockProcessor registy;
+
+ public void testConvertSeconds() throws Exception {
+ assertEquals(10000L, registy.convertTimeMillis("10 seconds"));
+ assertEquals(10000L, registy.convertTimeMillis("10 SECONDS"));
+ try {
+ registy.convertTimeMillis("10seconds");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertMinutes() throws Exception {
+ assertEquals(600000L, registy.convertTimeMillis("10 minutes"));
+ assertEquals(600000L, registy.convertTimeMillis("10 MINUTES"));
+ try {
+ registy.convertTimeMillis("10minutes");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertHours() throws Exception {
+ assertEquals(36000000L, registy.convertTimeMillis("10 hours"));
+ assertEquals(36000000L, registy.convertTimeMillis("10 HOURS"));
+ try {
+ registy.convertTimeMillis("10hours");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertDays() throws Exception {
+ assertEquals(864000000L, registy.convertTimeMillis("10 days"));
+ assertEquals(864000000L, registy.convertTimeMillis("10 DAYS"));
+ try {
+ registy.convertTimeMillis("10days");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertYears() throws Exception {
+ assertEquals(315569260000L, registy.convertTimeMillis("10 years"));
+ assertEquals(315569260000L, registy.convertTimeMillis("10 YEARS"));
+ try {
+ registy.convertTimeMillis("10years");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ public void testConvertDefault() throws Exception {
+ assertEquals(10000L, registy.convertTimeMillis("10 "));
+ assertEquals(10000L, registy.convertTimeMillis("10"));
+ }
+
+ public void testInvalid() throws Exception {
+ try {
+ registy.convertTimeMillis("foo");
+ fail();
+ } catch (NumberFormatException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ registy = new MockProcessor();
+ }
+
+ private class MockProcessor extends ConversationProcessor {
+
+ public MockProcessor() {
+ super(new DefaultAssemblyFactory());
+ }
+
+ @Override
+ protected long convertTimeMillis(String expr) throws NumberFormatException {
+ return super.convertTimeMillis(expr);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
new file mode 100644
index 0000000000..657ad757e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DestroyProcessorTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Foo.class.getMethod("destroy");
+ processor.visitMethod(method, type);
+ assertNotNull(type.getDestroyMethod());
+ }
+
+ public void testBadDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getMethod("badDestroy", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalDestructorException e) {
+ // expected
+ }
+ }
+
+ public void testTwoDestroy() throws Exception {
+ DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = Bar.class.getMethod("destroy");
+ Method method2 = Bar.class.getMethod("destroy2");
+ processor.visitMethod(method, type);
+ try {
+ processor.visitMethod(method2, type);
+ fail();
+ } catch (DuplicateDestructorException e) {
+ // expected
+ }
+ }
+
+
+ private class Foo {
+
+ @Destroy
+ public void destroy() {
+ }
+ }
+
+
+ private class Bar {
+
+ @Destroy
+ public void destroy() {
+ }
+
+ @Destroy
+ public void destroy2() {
+ }
+
+ @Destroy
+ public void badDestroy(String foo) {
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java
new file mode 100644
index 0000000000..9ece6cd164
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.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 org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.osoa.sca.annotations.EagerInit;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EagerInitProcessorTestCase extends TestCase {
+
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ public void testNoLevel() throws IntrospectionException {
+ EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Level.class, type);
+ }
+
+ public void testSubclass() throws IntrospectionException {
+ EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(SubClass.class, type);
+ }
+
+ @EagerInit
+ private class Level {
+ }
+
+ private class SubClass extends Level {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java
new file mode 100644
index 0000000000..d125366707
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicAndPropertyTestCase extends TestCase {
+
+ private PropertyProcessor propertyProcessor;
+ private HeuristicPojoProcessor heuristicProcessor;
+ private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+
+ /**
+ * Verifies the property and heuristic processors don't collide
+ */
+ @SuppressWarnings("unchecked")
+ public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor ctor = Foo.class.getConstructor(String.class);
+ type.setConstructor(new JavaConstructorImpl(ctor));
+ propertyProcessor.visitConstructorParameter(type.getConstructor().getParameters()[0], type);
+ heuristicProcessor.visitEnd(Foo.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertEquals("foo", type.getProperties().get(0).getName());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ propertyProcessor = new PropertyProcessor(assemblyFactory);
+ heuristicProcessor = new HeuristicPojoProcessor(assemblyFactory, new DefaultJavaInterfaceFactory(), introspector);
+ }
+
+ public static class Foo {
+ public Foo(@Property(name = "foo")
+ String prop) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
new file mode 100644
index 0000000000..de90130295
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
@@ -0,0 +1,315 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class HeuristicConstructorTestCase extends AbstractProcessorTest {
+
+ private AssemblyFactory factory;
+ private JavaInterfaceFactory javaFactory;
+ private HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeuristicConstructorTestCase() {
+ factory = new DefaultAssemblyFactory();
+ javaFactory = new DefaultJavaInterfaceFactory();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ processor = new HeuristicPojoProcessor(factory, javaFactory, introspector);
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<T> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a parameter as the type
+ */
+ public void testSingleConstructorWithParam() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
+ prop.setName("foo");
+ type.getProperties().add(prop);
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
+ type.getPropertyMembers().put("foo", element);
+ visitEnd(Foo1.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a reference as the type
+ */
+ public void testSingleConstructorWithRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName("foo");
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("foo", new JavaElementImpl("foo", String.class, null));
+ visitEnd(Foo1.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
+ }
+
+ /**
+ * Verifies a single constructor is chosen with a property and a reference
+ * as the type
+ */
+ public void testSingleConstructorWithPropRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+
+ org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
+ prop.setName("foo");
+ type.getProperties().add(prop);
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
+ type.getPropertyMembers().put("foo", element);
+
+ org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
+ visitEnd(Foo2.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals(2, type.getConstructor().getParameters().length);
+ }
+
+ public void testSingleConstructorResolvableParam() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo5.class, type);
+ assertEquals(String.class, type.getPropertyMembers().get("string").getType());
+ }
+
+ public void testSingleConstructorResolvableRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo6.class, type);
+ assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "ref"), Ref.class));
+ }
+
+ public void testSingleConstructorAmbiguousRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
+ org.apache.tuscany.sca.assembly.Reference ref2 = ModelHelper.createReference(factory, javaFactory, "ref2", Foo1.class);
+ type.getReferences().add(ref2);
+ type.getReferenceMembers().put("ref2", new JavaElementImpl("ref2", Foo1.class, null));
+ try {
+ visitEnd(Foo4.class, type);
+ fail();
+ } catch (AmbiguousConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testConstructorPropertyAnnotatedParamsOnly() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo7.class, type);
+ assertNotNull(getProperty(type, "myProp"));
+ }
+
+ public void testConstructorReferenceAnnotatedParamsOnly() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo8.class, type);
+ assertNotNull(ModelHelper.getReference(type, "myRef"));
+ }
+
+ @SuppressWarnings("unchecked")
+ public void testDefaultConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo3.class, type);
+ assertNotNull(type.getConstructor().getConstructor());
+ }
+
+ public void testSameTypesButAnnotated() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo12.class, type);
+ assertEquals(2, type.getProperties().size());
+ assertNotNull(getProperty(type, "prop1"));
+ assertNotNull(getProperty(type, "prop2"));
+ }
+
+ /**
+ * Verifies processing executes with additional extension annotations
+ */
+ public void testRandomAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo11.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertNotNull(getProperty(type, "prop1"));
+ }
+
+ public void testPrivateConstructor() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ visitEnd(Foo14.class, type);
+ fail();
+ } catch (NoConstructorException e) {
+ // expected
+ }
+ }
+
+ public void testMultipleConstructors() throws Exception {
+ // throw new UnsupportedOperationException("Finish heuristic multiple
+ // constructors - Foo10");
+ }
+
+ public static class Foo1 {
+ public Foo1(String val) {
+ }
+ }
+
+ public static class Foo2 {
+ public Foo2(String val, Foo1 ref) {
+ }
+ }
+
+ public static class Foo3 {
+ }
+
+ public static class Foo4 {
+ public Foo4(Foo1 ref) {
+ }
+ }
+
+ public static class Prop {
+
+ }
+
+ @Remotable
+ public static interface Ref {
+
+ }
+
+ public static class Foo5 {
+ public Foo5(String val) {
+ }
+ }
+
+ public static class Foo6 {
+ public Foo6(Ref ref) {
+ }
+ }
+
+ public static class Foo7 {
+ public Foo7(@Property(name = "myProp")
+ String prop) {
+ }
+ }
+
+ public static class Foo8 {
+ public Foo8(@Reference(name = "myRef")
+ String ref) {
+ }
+ }
+
+ public static class Foo9 {
+ public Foo9(@Reference(name = "myRef")
+ String ref) {
+ }
+ }
+
+ public static class Foo10 {
+
+ public Foo10() {
+ }
+
+ public Foo10(String prop) {
+ }
+
+ public Foo10(@Property(name = "prop1")
+ String prop1, @Property(name = "prop2")
+ String prop2) {
+
+ }
+ }
+
+ public static class Foo11 {
+
+ public Foo11(@Property(name = "prop1")
+ String prop, @Baz
+ String baz) {
+ }
+ }
+
+ public static class Foo12 {
+
+ public Foo12(@Property(name = "prop1")
+ String prop, @Property(name = "prop2")
+ String baz) {
+ }
+ }
+
+ public @interface Baz {
+
+ }
+
+ public static class Foo13 {
+ public Foo13(@Reference
+ String foo) {
+ }
+ }
+
+ public static final class Foo14 {
+ private Foo14() {
+ }
+ }
+
+ public static final class Foo15 {
+ public Foo15(@Reference
+ String param1, @Reference
+ String param2) {
+ }
+ }
+
+ public static final class Foo16 {
+ public Foo16(@Reference
+ String param1, @Property(name = "foo")
+ String param2, @Reference(name = "bar")
+ String param3) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
new file mode 100644
index 0000000000..323daf52d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
@@ -0,0 +1,411 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Verfies component type information is properly introspected from an unadorned
+ * POJO according to the SCA Java Client and Implementation Model Specification
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeuristicPojoProcessorTestCase extends AbstractProcessorTest {
+
+ private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeuristicPojoProcessorTestCase() {
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), introspector);
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<T> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies a single service interface is computed when only one interface
+ * is implemented
+ */
+ public void testSingleInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceImpl.class, type);
+ assertEquals(1, type.getServices().size());
+ assertTrue(ModelHelper.matches(ModelHelper.getService(type, PropertyInterface.class.getSimpleName()),
+ PropertyInterface.class));
+ assertTrue(type.getProperties().isEmpty());
+ assertTrue(type.getReferences().isEmpty());
+ }
+
+ /**
+ * Verifies property and reference setters are computed
+ */
+ public void testPropertyReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor = SingleInterfaceWithPropertyReferenceImpl.class
+ .getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceWithPropertyReferenceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceWithPropertyReferenceImpl.class, type);
+ assertEquals(1, type.getServices().size());
+ assertTrue(ModelHelper
+ .matches(ModelHelper.getService(type, Interface1.class.getSimpleName()), Interface1.class));
+ assertEquals(1, type.getProperties().size());
+ org.apache.tuscany.sca.assembly.Property prop = ModelHelper.getProperty(type, "property");
+ assertNotNull(prop);
+ assertEquals(ComplexProperty.class, type.getPropertyMembers().get("property").getType());
+ assertEquals(1, type.getReferences().size());
+ assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "reference"), Ref.class));
+ }
+
+ /**
+ * Verifies that a property setter is not introspected if an analogous
+ * operation is in the service interface
+ */
+ public void testPropertySetterInInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
+ processor.visitEnd(SingleInterfaceImpl.class, type);
+ assertEquals(0, type.getProperties().size());
+ }
+
+ /**
+ * Verifies that a reference setter is not introspected if an analogous
+ * operation is in the service interface
+ */
+ public void testReferenceSetterInInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<RefInterfaceImpl> ctor = RefInterfaceImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<RefInterfaceImpl>(ctor));
+ processor.visitEnd(RefInterfaceImpl.class, type);
+ assertEquals(0, type.getReferences().size());
+ }
+
+ /**
+ * Verifies collection generic types or array types are introspected as
+ * references according to spec rules
+ */
+ public void testReferenceCollectionType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ReferenceCollectionImpl>(ctor));
+ processor.visitEnd(ReferenceCollectionImpl.class, type);
+ assertEquals(1, type.getProperties().size());
+ assertEquals(3, type.getReferences().size());
+ }
+
+ /**
+ * Verifies collection generic types or array types are introspected as
+ * properties according to spec rules
+ */
+ public void testPropertyCollectionType() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<PropertyCollectionImpl>(ctor));
+ processor.visitEnd(PropertyCollectionImpl.class, type);
+ assertEquals(0, type.getReferences().size());
+ assertEquals(4, type.getProperties().size());
+ }
+
+ /**
+ * Verifies references are calculated when the type marked with is
+ *
+ * @Remotable
+ */
+ public void testRemotableRef() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<RemotableRefImpl>(ctor));
+ processor.visitEnd(RemotableRefImpl.class, type);
+ assertEquals(2, type.getReferences().size());
+ assertEquals(0, type.getProperties().size());
+ }
+
+ public void testParentInterface() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Child> ctor = Child.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<Child>(ctor));
+ processor.visitEnd(Child.class, type);
+ assertNotNull(ModelHelper.getService(type, Interface1.class.getSimpleName()));
+ }
+
+ /**
+ * Verifies a service inteface is calculated when only props and refs are
+ * given
+ */
+ public void testExcludedPropertyAndReference() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName("reference");
+ type.getReferences().add(ref);
+ type.getReferenceMembers().put("reference", new JavaElementImpl("reference", Ref.class, null));
+ org.apache.tuscany.sca.assembly.Reference ref2 = factory.createReference();
+ ref2.setName("reference2");
+ type.getReferences().add(ref2);
+ type.getReferenceMembers().put("reference2", new JavaElementImpl("reference2", Ref.class, null));
+ org.apache.tuscany.sca.assembly.Property prop1 = factory.createProperty();
+ prop1.setName("string1");
+ type.getProperties().add(prop1);
+ type.getPropertyMembers().put("string1", new JavaElementImpl("string1", String.class, null));
+ org.apache.tuscany.sca.assembly.Property prop2 = factory.createProperty();
+ prop2.setName("string2");
+ type.getProperties().add(prop2);
+ type.getPropertyMembers().put("string2", new JavaElementImpl("string2", String.class, null));
+ visitEnd(MockService.class, type);
+ assertEquals(1, type.getServices().size());
+ }
+
+ public void testProtectedRemotableRefField() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefFieldImpl>(ctor));
+ processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
+ assertNotNull(ModelHelper.getReference(type, "otherRef"));
+ }
+
+ public void testProtectedRemotableRefMethod() throws IntrospectionException, NoSuchMethodException {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefMethodImpl>(ctor));
+ processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
+ assertNotNull(ModelHelper.getReference(type, "otherRef"));
+ }
+
+ public void testSetDataTypes() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor();
+ type.setConstructor(new JavaConstructorImpl<PropertyIntTypeOnConstructor>(ctor));
+ processor.visitEnd(PropertyIntTypeOnConstructor.class, type);
+ org.apache.tuscany.sca.assembly.Property foo = ModelHelper.getProperty(type, "foo");
+ assertEquals(int.class, type.getPropertyMembers().get("foo").getType());
+ assertEquals(new QName(JavaXMLMapper.URI_2001_SCHEMA_XSD, "int"), foo.getXSDType());
+ }
+
+ private static class PropertyIntTypeOnConstructor {
+ protected int foo;
+
+ public PropertyIntTypeOnConstructor() {
+ }
+
+ public int getFoo() {
+ return foo;
+ }
+ }
+
+ private interface PropertyInterface {
+ void setString1(String val);
+ }
+
+ private interface Interface1 {
+ }
+
+ private static class Parent implements Interface1 {
+
+ }
+
+ private static class Child extends Parent {
+ public Child() {
+ }
+
+ }
+
+ private static class SingleInterfaceImpl implements PropertyInterface {
+ public SingleInterfaceImpl() {
+ }
+
+ public void setString1(String val) {
+ }
+
+ }
+
+ private interface HeuristicServiceInterface {
+ void fooOperation(String ref);
+
+ void setInvalid1(); // No parameter
+
+ void setInvalid2(String str, int i); // More than one parameter
+
+ String setInvalid3(String str); // return should be void
+ }
+
+ public static class MockService implements PropertyInterface, RefInterface, HeuristicServiceInterface {
+
+ @Property
+ public void setString1(String val) {
+ }
+
+ @Property
+ public void setString2(String val) {
+ }
+
+ @Reference
+ public void setReference(Ref ref) {
+ }
+
+ @Reference
+ public void setReference2(Ref ref) {
+ }
+
+ public void fooOperation(String ref) {
+
+ }
+
+ public void setInvalid1() {
+ }
+
+ public void setInvalid2(String str, int i) {
+ }
+
+ public String setInvalid3(String str) {
+ return null;
+ }
+
+ }
+
+ @Service
+ private interface Ref {
+ }
+
+ private class ComplexProperty {
+ }
+
+ private interface RefInterface {
+ void setReference(Ref ref);
+ }
+
+ private static class RefInterfaceImpl implements RefInterface {
+ public RefInterfaceImpl() {
+ }
+
+ public void setReference(Ref ref) {
+ }
+ }
+
+ private static class SingleInterfaceWithPropertyReferenceImpl implements Interface1 {
+ public SingleInterfaceWithPropertyReferenceImpl() {
+ }
+
+ public void setReference(Ref ref) {
+ }
+
+ public void setProperty(ComplexProperty prop) {
+ }
+ }
+
+ private static class ReferenceCollectionImpl implements Interface1 {
+ public ReferenceCollectionImpl() {
+ }
+
+ public void setCollectionReference(Collection<Ref> ref) {
+ }
+
+ public void setNonGenericCollectionReference(Collection ref) {
+ // [rfeng] By the SCA spec, this should be classified as property
+ }
+
+ public void setListReference(List<Ref> ref) {
+ }
+
+ public void setArrayReference(Ref[] ref) {
+ }
+ }
+
+ private static class PropertyCollectionImpl implements Interface1 {
+ public PropertyCollectionImpl() {
+ }
+
+ public void setCollectionProperty(Collection<ComplexProperty> prop) {
+ }
+
+ public void setCollectionProperty2(Collection<String> prop) {
+ }
+
+ public void setArrayProperty(ComplexProperty[] prop) {
+ }
+
+ public void setArrayProperty2(String[] prop) {
+ }
+ }
+
+ @Remotable
+ private interface RemotableRef {
+ }
+
+ private static class RemotableRefImpl implements Interface1 {
+ protected RemotableRef otherRef;
+
+ public RemotableRefImpl() {
+ }
+
+ public void setRef(RemotableRef ref) {
+
+ }
+ }
+
+ private static class ProtectedRemotableRefFieldImpl implements Interface1 {
+ protected RemotableRef otherRef;
+
+ public ProtectedRemotableRefFieldImpl() {
+ }
+
+ public ProtectedRemotableRefFieldImpl(RemotableRef otherRef) {
+ this.otherRef = otherRef;
+ }
+
+ }
+
+ private static class ProtectedRemotableRefMethodImpl implements Interface1 {
+ public ProtectedRemotableRefMethodImpl() {
+ }
+
+ protected void setOtherRef(RemotableRef otherRef) {
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
new file mode 100644
index 0000000000..8499e344ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+
+/**
+ * Verifies constructors that have extensible annotation types, i.e. that have
+ * parameters marked by annotations which are themselves processed by some other
+ * implementation processor
+ *
+ * @version $Rev$ $Date$
+ */
+public class HeutisticExtensibleConstructorTestCase extends AbstractProcessorTest {
+
+ private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public HeutisticExtensibleConstructorTestCase() {
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), introspector);
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
+ for (Constructor<T> constructor : clazz.getConstructors()) {
+ visitConstructor(constructor, type);
+ }
+ processor.visitEnd(clazz, type);
+ }
+
+ /**
+ * Verifies heuristic processing can be called priot to an extension
+ * annotation processors being called.
+ */
+ public void testBarAnnotationProcessedFirst() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
+ JavaConstructorImpl<Foo> definition = new JavaConstructorImpl<Foo>(ctor);
+ type.setConstructor(definition);
+ Property property = factory.createProperty();
+ property.setName("myBar");
+ definition.getParameters()[0].setName("myBar");
+ type.getProperties().add(property);
+ visitEnd(Foo.class, type);
+ assertEquals(2, type.getProperties().size());
+ }
+
+ /**
+ * Verifies heuristic processing can be called before an extension
+ * annotation processors is called. <p/> For example, given:
+ *
+ * <pre>
+ * Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = &quot;foo&quot;) String prop2)
+ * </pre>
+ *
+ * <p/> Heuristic evaluation of
+ * @Property can occur prior to another implementation processor evaluating
+ * @Bar
+ * @throws Exception
+ */
+ public void testBarAnnotationProcessedLast() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ visitEnd(Foo.class, type);
+
+ // now simulate process the bar impl
+ JavaConstructorImpl<?> definition = type.getConstructor();
+ definition.getParameters()[0].setName("myBar");
+ Property property = factory.createProperty();
+ property.setName("myBar");
+ type.getProperties().add(property);
+
+ assertEquals(2, type.getProperties().size());
+ assertEquals("foo", definition.getParameters()[1].getName());
+ }
+
+ /**
+ * Verifies heuristic processing can be called before an extension
+ * annotation processors is called with the extension parameter in a middle
+ * position. Specifically, verifies that the heuristic processor updates
+ * injection names and preserves their ordering.
+ */
+ public void testBarAnnotationProcessedFirstInMiddle() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
+ JavaConstructorImpl<Foo2> definition = new JavaConstructorImpl<Foo2>(ctor);
+ type.setConstructor(definition);
+ // insert placeholder for first param, which would be done by a
+ // processor
+ definition.getParameters()[0].setName("");
+ Property property = factory.createProperty();
+ // Hack to add a property member
+ JavaElementImpl element = new JavaElementImpl("myBar", String.class, null);
+ type.getPropertyMembers().put("myBar", element);
+ property.setName("myBar");
+ definition.getParameters()[1].setName("myBar");
+ type.getProperties().add(property);
+ visitEnd(Foo2.class, type);
+ assertEquals("baz", definition.getParameters()[0].getName());
+ assertEquals(2, type.getProperties().size());
+ assertEquals(1, type.getReferences().size());
+ }
+
+ public @interface Bar {
+
+ }
+
+ public static class Foo {
+ public Foo(@Bar
+ String prop, @org.osoa.sca.annotations.Property(name = "foo")
+ String prop2) {
+ }
+ }
+
+ public static class Foo2 {
+ public Foo2(@org.osoa.sca.annotations.Reference(name = "baz")
+ String prop1, @Bar
+ String prop2, @org.osoa.sca.annotations.Property(name = "foo")
+ String prop3) {
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
new file mode 100644
index 0000000000..be2b5aa56e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.osoa.sca.annotations.Init;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InitProcessorTestCase extends TestCase {
+
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public InitProcessorTestCase() {
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ public void testInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Foo.class.getMethod("init");
+ processor.visitMethod(method, type);
+ assertNotNull(type.getInitMethod());
+ }
+
+ public void testBadInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("badInit", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalInitException e) {
+ // expected
+ }
+ }
+
+ public void testTwoInit() throws Exception {
+ InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ Method method = InitProcessorTestCase.Bar.class.getMethod("init");
+ Method method2 = InitProcessorTestCase.Bar.class.getMethod("init2");
+ processor.visitMethod(method, type);
+ try {
+ processor.visitMethod(method2, type);
+ fail();
+ } catch (DuplicateInitException e) {
+ // expected
+ }
+ }
+
+
+ private class Foo {
+ @Init
+ public void init() {
+ }
+ }
+
+
+ private class Bar {
+ @Init
+ public void init() {
+ }
+
+ @Init
+ public void init2() {
+ }
+
+ @Init
+ public void badInit(String foo) {
+ }
+
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java
new file mode 100644
index 0000000000..aad6b96cf9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.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.sca.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ModelHelper {
+
+ public static Property getProperty(JavaImplementation type, String name) {
+ for (Property prop : type.getProperties()) {
+ if (prop.getName().equals(name)) {
+ return prop;
+ }
+ }
+ return null;
+ }
+
+ public static Reference getReference(JavaImplementation type, String name) {
+ for (Reference ref : type.getReferences()) {
+ if (ref.getName().equals(name)) {
+ return ref;
+ }
+ }
+ return null;
+ }
+
+ public static Service getService(JavaImplementation type, String name) {
+ for (Service svc : type.getServices()) {
+ if (svc.getName().equals(name)) {
+ return svc;
+ }
+ }
+ return null;
+ }
+
+ public static boolean matches(Contract contract, Class<?> type) {
+ Interface interface1 = contract.getInterfaceContract().getInterface();
+ if (interface1 instanceof JavaInterface) {
+ return type == ((JavaInterface)interface1).getJavaClass();
+ } else {
+ return false;
+ }
+ }
+
+ public static ComponentService createService(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, Class<?> type) {
+ org.apache.tuscany.sca.assembly.ComponentService ref = factory.createComponentService();
+ ref.setName(type.getSimpleName());
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+ public static Reference createReference(AssemblyFactory factory,
+ JavaInterfaceFactory javaFactory, String name, Class<?> type) {
+ org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
+ ref.setName(name);
+ JavaInterface i = javaFactory.createJavaInterface();
+ i.setJavaClass(type);
+ JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
+ ic.setInterface(i);
+ ref.setInterfaceContract(ic);
+ return ref;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
new file mode 100644
index 0000000000..25d37a6eca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
@@ -0,0 +1,406 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.Intent;
+import org.osoa.sca.annotations.Requires;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyProcessorTestCase extends TestCase {
+ private ServiceProcessor serviceProcessor;
+ private PolicyProcessor policyProcessor;
+ private JavaImplementation type;
+
+ // This actually is a test for PolicyJavaInterfaceProcessor. It will get
+ // invoked via the call to ImplementationProcessorServiceImpl.createService in
+ // ServiceProcessor. Of course ServiceProcessor class has to be working.
+ public void testSingleInterfaceWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service1.class, type);
+ policyProcessor.visitClass(Service1.class, type);
+ verifyIntents(Service1.class, type);
+ }
+
+ public void testMultipleInterfacesWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
+ serviceProcessor.visitClass(Service2.class, type);
+ policyProcessor.visitClass(Service2.class, type);
+ verifyIntents(Service2.class, type);
+ }
+
+ public void testSingleInterfaceWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service3.class, type);
+ policyProcessor.visitClass(Service3.class, type);
+ verifyIntents(Service3.class, type);
+ }
+
+ public void testMultipleInterfacesWithIntentsOnImplAtClassLevel() throws Exception {
+ serviceProcessor.visitClass(Service4.class, type);
+ policyProcessor.visitClass(Service4.class, type);
+ verifyIntents(Service4.class, type);
+ }
+
+ public void testSingleInterfaceWithIntentsOnInterfaceAtMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service5.class, type);
+ policyProcessor.visitClass(Service5.class, type);
+ verifyIntents(Service5.class, type);
+ }
+
+ public void testSingleInterfaceWithIntentsOnServiceAndInterfaceAtImplAndInertfaceAndMethodLevel() throws Exception {
+ serviceProcessor.visitClass(Service6.class, type);
+ policyProcessor.visitClass(Service6.class, type);
+ for (Method method : Service6.class.getDeclaredMethods()) {
+ policyProcessor.visitMethod(method, type);
+ }
+ verifyIntents(Service6.class, type);
+ }
+
+ private void verifyIntents(Class serviceImplClass, JavaImplementation type) {
+
+ Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
+ if (serviceImplIntentAnnotation != null) {
+ String[] serviceImplIntents = serviceImplIntentAnnotation.value();
+ List<Intent> requiredIntents = type.getRequiredIntents();
+ if (serviceImplIntents.length > 0) {
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on the service ");
+ }
+ Map<String, Intent> intentMap = new HashMap<String, Intent>();
+ for (Intent intent : requiredIntents) {
+ intentMap.put(intent.getName().getLocalPart(), intent);
+ }
+ for (String intent : serviceImplIntents) {
+ assertTrue("ComponentType for Service class " + serviceImplClass.getName()
+ + " did not contain Service Implementation intent "
+ + intent, intentMap.containsKey(intent));
+ }
+ }
+ }
+
+ // This should match what was specified on @Service for a Service Implementation
+ // If we use these to get the Service names and we get a null Service
+ // name then it would seem that wrong values were put on the @Service annotation
+ // or the wrong interfaces were specified on the implements list of the class
+ // statement?
+ Map<String, org.apache.tuscany.sca.assembly.Service> serviceMap = new HashMap<String, org.apache.tuscany.sca.assembly.Service>();
+ for (org.apache.tuscany.sca.assembly.Service service: type.getServices()) {
+ serviceMap.put(service.getName(), service);
+ }
+ for (Class interfaceClass : serviceImplClass.getInterfaces()) {
+ Requires interfaceIntentAnnotation = (Requires)interfaceClass.getAnnotation(Requires.class);
+ org.apache.tuscany.sca.assembly.Service service = serviceMap.get(interfaceClass.getSimpleName());
+ if (service == null) {
+ fail("No service defined for interface " + interfaceClass.getSimpleName()
+ + " on Service Implementation "
+ + serviceImplClass.getName());
+ }
+
+ if (interfaceIntentAnnotation != null) {
+ String[] interfaceIntents = interfaceIntentAnnotation.value();
+ List<Intent> requiredIntents = service.getRequiredIntents();
+ if (interfaceIntents.length > 0) {
+ if (requiredIntents == null || requiredIntents.size() == 0) {
+ fail("No Intents on the service " + service.getName());
+ }
+ Map<String, Intent> intentMap = new HashMap<String, Intent>();
+ for (Intent intent : requiredIntents) {
+ intentMap.put(intent.getName().getLocalPart(), intent);
+ }
+ for (String intent : interfaceIntents) {
+ assertTrue("Interface " + service.getName()
+ + " did not contain Service Interface intent "
+ + intent, intentMap.containsKey(intent));
+ }
+ }
+ }
+
+ for (Method method : interfaceClass.getDeclaredMethods()) {
+ Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
+
+ // Verify that each of the Intents on each of the Service
+ // Interface Methods exist on their associated operation.
+ if (methodIntentAnnotation != null) {
+ String[] methodIntents = methodIntentAnnotation.value();
+ if (methodIntents.length > 0) {
+ List<Intent> requiredIntents = service.getRequiredIntents();
+ if (requiredIntents.size() == 0) {
+ fail("No Intents on operation " + method.getName());
+ }
+ for (String intent : methodIntents) {
+ boolean found = false;
+ for (Intent requiredIntent: requiredIntents) {
+ if (requiredIntent.getName().getLocalPart().equals(intent)) {
+ for (Operation operation: requiredIntent.getOperations()) {
+ if (operation.getName().equals(method.getName())) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found)
+ break;
+ }
+ assertTrue("Operation " + method.getName()
+ + " did not contain Service Interface method intent "
+ + intent, found);
+ }
+ }
+ }
+ }
+
+ for (Method method : serviceImplClass.getDeclaredMethods()) {
+ Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
+
+ // Verify that each of the Intents on each of the Service
+ // Implementation Methods exist on their associated
+ // operation.
+ if (methodIntentAnnotation != null) {
+ String[] methodIntents = methodIntentAnnotation.value();
+ if (methodIntents.length > 0) {
+ List<Intent> requiredIntents = type.getRequiredIntents();
+ if (requiredIntents.size() == 0) {
+ fail("No Intents on operation " + method.getName());
+ }
+ for (String intent : methodIntents) {
+ boolean found = false;
+ for (Intent requiredIntent: requiredIntents) {
+ if (requiredIntent.getName().getLocalPart().equals(intent)) {
+ for (Operation operation: requiredIntent.getOperations()) {
+ if (operation.getName().equals(method.getName())) {
+ found = true;
+ break;
+ }
+ }
+ }
+ if (found)
+ break;
+ }
+ assertTrue("Operation " + method.getName()
+ + " did not contain Service Interface method intent "
+ + intent, found);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), introspector);
+ policyProcessor = new PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ // @Remotable
+ @Requires( {"transaction.global"})
+ private interface Interface1 {
+ int method1();
+
+ int method2();
+
+ int method3();
+
+ int method4();
+ }
+
+ @Service(Interface1.class)
+ private class Service1 implements Interface1 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ @Requires( {"transaction.local"})
+ private interface Interface2 {
+ int method5();
+
+ int method6();
+ }
+
+ @Service(interfaces = {Interface1.class, Interface2.class})
+ private class Service2 implements Interface1, Interface2 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+
+ public int method5() {
+ return 0;
+ }
+
+ public int method6() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ private interface Interface3 {
+ int method1();
+
+ int method2();
+
+ int method3();
+
+ int method4();
+ }
+
+ @Service(Interface3.class)
+ @Requires( {"transaction.global"})
+ private class Service3 implements Interface3 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+ }
+
+ // @Remotable
+ private interface Interface4 {
+ int method5();
+
+ int method6();
+ }
+
+ @Service(interfaces = {Interface3.class, Interface4.class})
+ @Requires( {"transaction.local"})
+ private class Service4 implements Interface3, Interface4 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+
+ public int method3() {
+ return 0;
+ }
+
+ public int method4() {
+ return 0;
+ }
+
+ public int method5() {
+ return 0;
+ }
+
+ public int method6() {
+ return 0;
+ }
+ }
+
+ private interface Interface5 {
+ @Requires( {"transaction.global"})
+ int method1();
+
+ @Requires( {"transaction.local"})
+ int method2();
+ }
+
+ @Service(Interface5.class)
+ private class Service5 implements Interface5 {
+ public int method1() {
+ return 0;
+ }
+
+ public int method2() {
+ return 0;
+ }
+ }
+
+ @Requires( {"transaction.global.Interface6"})
+ private interface Interface6 {
+ @Requires( {"transaction.global.Interface6.method1"})
+ int method1();
+
+ @Requires( {"transaction.local.Interface6.method2"})
+ int method2();
+ }
+
+ @Service(Interface6.class)
+ @Requires( {"transaction.global.Service6"})
+ private class Service6 implements Interface6 {
+ @Requires( {"transaction.global.Service6.method1"})
+ public int method1() {
+ return 0;
+ }
+
+ @Requires( {"transaction.global.Service6.method1"})
+ public int method2() {
+ return 0;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
new file mode 100644
index 0000000000..ccac012138
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.DuplicatePropertyException;
+import org.apache.tuscany.sca.implementation.java.introspect.IllegalPropertyException;
+import org.osoa.sca.annotations.Property;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PropertyProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ PropertyProcessor processor;
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setFoo", String.class), type);
+ assertNotNull(getProperty(type, "foo"));
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setFooRequired", String.class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "fooRequired");
+ assertNotNull(prop);
+ assertTrue(prop.isMustSupply());
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(Foo.class.getMethod("setBarMethod", String.class), type);
+ assertNotNull(getProperty(type, "bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("baz"), type);
+ assertNotNull(getProperty(type, "baz"));
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("bazRequired"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "bazRequired");
+ assertNotNull(prop);
+ assertTrue(prop.isMustSupply());
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(Foo.class.getDeclaredField("bazField"), type);
+ assertNotNull(getProperty(type, "theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(Bar.class.getDeclaredField("dup"), type);
+ try {
+ processor.visitField(Bar.class.getDeclaredField("baz"), type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(Bar.class.getMethod("dupMethod", String.class), type);
+ try {
+ processor.visitMethod(Bar.class.getMethod("dupSomeMethod", String.class), type);
+ fail();
+ } catch (DuplicatePropertyException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(Bar.class.getMethod("badMethod"), type);
+ fail();
+ } catch (IllegalPropertyException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ processor = new PropertyProcessor(new DefaultAssemblyFactory());
+ }
+
+ private class Foo {
+
+ @Property
+ protected String baz;
+ @Property(required = true)
+ protected String bazRequired;
+ @Property(name = "theBaz")
+ protected String bazField;
+
+ @Property
+ public void setFoo(String string) {
+ }
+
+ @Property(required = true)
+ public void setFooRequired(String string) {
+ }
+
+ @Property(name = "bar")
+ public void setBarMethod(String string) {
+ }
+
+ }
+
+ private class Bar {
+
+ @Property
+ protected String dup;
+
+ @Property(name = "dup")
+ protected String baz;
+
+ @Property
+ public void dupMethod(String s) {
+ }
+
+ @Property(name = "dupMethod")
+ public void dupSomeMethod(String s) {
+ }
+
+ @Property
+ public void badMethod() {
+ }
+
+ }
+
+ private class Multiple {
+ @Property
+ protected List<String> refs1;
+
+ @Property
+ protected String[] refs2;
+
+ @Property
+ public void setRefs3(String[] refs) {
+ }
+
+ @Property
+ public void setRefs4(Collection<String> refs) {
+ }
+
+ }
+
+ private Class<?> getBaseType(JavaElementImpl element) {
+ return JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
+ }
+
+ public void testMultiplicityCollection() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs1"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs1");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArray() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs2");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityArrayMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs3", String[].class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs3");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+ public void testMultiplicityCollectionMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
+ org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs4");
+ assertNotNull(prop);
+ assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
+ assertTrue(prop.isMany());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
new file mode 100644
index 0000000000..f70cef6090
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
+
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.Multiplicity;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProcessorTestCase extends TestCase {
+
+ private JavaImplementation type;
+ private ReferenceProcessor processor;
+
+ public void testMethodAnnotation() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFoo", Ref.class), type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "foo");
+ assertNotNull(reference);
+ assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testMethodRequired() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFooRequired", Ref.class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "fooRequired");
+ assertNotNull(ref);
+ assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMethodName() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setBarMethod", Ref.class), type);
+ assertNotNull(getReference(type, "bar"));
+ }
+
+ public void testFieldAnnotation() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("baz"), type);
+ org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "baz");
+ assertNotNull(reference);
+ assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testFieldRequired() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazRequired"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "bazRequired");
+ assertNotNull(ref);
+ assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testFieldName() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazField"), type);
+ assertNotNull(getReference(type, "theBaz"));
+ }
+
+ public void testDuplicateFields() throws Exception {
+ processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("dup"), type);
+ try {
+ processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("baz"), type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateMethods() throws Exception {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("dupMethod", Ref.class), type);
+ try {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("dupSomeMethod", Ref.class), type);
+ fail();
+ } catch (DuplicateReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testInvalidProperty() throws Exception {
+ try {
+ processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("badMethod"), type);
+ fail();
+ } catch (IllegalReferenceException e) {
+ // expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ processor = new ReferenceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors));
+ }
+
+ private interface Ref {
+ }
+
+ private class Foo {
+
+ @Reference
+ protected Ref baz;
+ @Reference(required = true)
+ protected Ref bazRequired;
+ @Reference(name = "theBaz")
+ protected Ref bazField;
+
+ @Reference
+ public void setFoo(Ref ref) {
+ }
+
+ @Reference(required = true)
+ public void setFooRequired(Ref ref) {
+ }
+
+ @Reference(name = "bar")
+ public void setBarMethod(Ref ref) {
+ }
+
+ }
+
+ private class Bar {
+
+ @Reference
+ protected Ref dup;
+
+ @Reference(name = "dup")
+ protected Ref baz;
+
+ @Reference
+ public void dupMethod(Ref s) {
+ }
+
+ @Reference(name = "dupMethod")
+ public void dupSomeMethod(Ref s) {
+ }
+
+ @Reference
+ public void badMethod() {
+ }
+
+ }
+
+ private class Multiple {
+ @Reference(required = true)
+ protected List<Ref> refs1;
+
+ @Reference(required = false)
+ protected Ref[] refs2;
+
+ @Reference(required = true)
+ public void setRefs3(Ref[] refs) {
+ }
+
+ @Reference(required = false)
+ public void setRefs4(Collection<Ref> refs) {
+ }
+
+ }
+
+ public void testMultiplicity1ToN() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs1"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs1");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
+ // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMultiplicityTo0ToN() throws Exception {
+ processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs2");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
+ // assertFalse(ref.isMustSupply());
+ }
+
+ public void testMultiplicity1ToNMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs3", Ref[].class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs3");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
+ // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
+ }
+
+ public void testMultiplicity0ToNMethod() throws Exception {
+ processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
+ org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs4");
+ assertNotNull(ref);
+ assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
+ // assertFalse(ref.isMustSupply());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
new file mode 100644
index 0000000000..87ac37fea9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessorTestCase extends TestCase {
+
+ JavaImplementation type;
+ ResourceProcessor processor = new ResourceProcessor(new DefaultAssemblyFactory());
+
+ public void testVisitField() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(field, type);
+ JavaResourceImpl resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(field.getType(), resource.getElement().getType());
+ }
+
+ public void testVisitMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar", Bar.class);
+ processor.visitMethod(method, type);
+ JavaResourceImpl resource = type.getResources().get("bar");
+ assertFalse(resource.isOptional());
+ assertNull(resource.getMappedName());
+ assertEquals(method.getParameterTypes()[0], resource.getElement().getType());
+ }
+
+ public void testVisitNamedMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBar2", Bar.class);
+ processor.visitMethod(method, type);
+ JavaResourceImpl resource = type.getResources().get("someName");
+ assertFalse(resource.isOptional());
+ assertEquals("mapped", resource.getMappedName());
+ }
+
+ public void testVisitBadMethod() throws Exception {
+ Method method = Foo.class.getMethod("setBad");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalResourceException e) {
+ // expected
+ }
+ }
+
+ public void testDuplicateResources() throws Exception {
+ Field field = Foo.class.getDeclaredField("bar");
+ processor.visitField(field, type);
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (DuplicateResourceException e) {
+ //expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ private class Foo {
+
+ @org.apache.tuscany.api.annotation.Resource
+ protected Bar bar;
+
+ @org.apache.tuscany.api.annotation.Resource(optional = true)
+ protected Bar barNotRequired;
+
+ @org.apache.tuscany.api.annotation.Resource
+ public void setBar(Bar bar) {
+ }
+
+ @org.apache.tuscany.api.annotation.Resource(name = "someName", mappedName = "mapped")
+ public void setBar2(Bar bar) {
+ }
+
+ @org.apache.tuscany.api.annotation.Resource
+ public void setBad() {
+ }
+
+ }
+
+ private interface Bar {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java
new file mode 100644
index 0000000000..8faaf6949f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessorTestCase extends TestCase {
+
+ Component parent;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public void testCompositeScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+
+ processor.visitClass(Composite.class, type);
+ assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
+ }
+
+ public void testSessionScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Session.class, type);
+ assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
+ }
+
+ public void testConversationalScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Conversation.class, type);
+ assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
+ }
+
+ public void testRequestScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Request.class, type);
+ assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
+ }
+
+ public void testStatelessScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(Stateless.class, type);
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
+ }
+
+ public void testNoScope() throws IntrospectionException {
+ ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(None.class, type);
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ parent = EasyMock.createNiceMock(Component.class);
+ }
+
+ @org.osoa.sca.annotations.Scope("COMPOSITE")
+ private class Composite {
+ }
+
+ @org.osoa.sca.annotations.Scope("SESSION")
+ private class Session {
+ }
+
+ @org.osoa.sca.annotations.Scope("CONVERSATION")
+ private class Conversation {
+ }
+
+ @org.osoa.sca.annotations.Scope("REQUEST")
+ private class Request {
+ }
+
+ @org.osoa.sca.annotations.Scope("SYSTEM")
+ private class System {
+ }
+
+ @org.osoa.sca.annotations.Scope("STATELESS")
+ private class Stateless {
+ }
+
+ private class None {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
new file mode 100644
index 0000000000..0c98c0655e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.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.tuscany.sca.implementation.java.introspect.impl;
+
+import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getService;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceCallbackTestCase extends TestCase {
+ private ServiceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors));
+ javaImplementationFactory = new DefaultJavaImplementationFactory();
+ }
+
+ public void testMethodCallbackInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
+ processor.visitMethod(method, type);
+ assertEquals(method, type.getCallbackMembers().get(FooCallback.class.getName()).getAnchor());
+ }
+
+ public void testFieldCallbackInterface() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(FooImpl.class, type);
+ org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
+ assertNotNull(service);
+ Field field = FooImpl.class.getDeclaredField("callback");
+ processor.visitField(field, type);
+ assertEquals(field, type.getCallbackMembers().get(FooCallback.class.getName()).getAnchor());
+ }
+
+ public void testMethodDoesNotMatchCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testNoParamCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Method method = BadBarImpl.class.getMethod("setNoParamCallback");
+ try {
+ processor.visitMethod(method, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testFieldDoesNotMatchCallback() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ processor.visitClass(BadBarImpl.class, type);
+ Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
+ try {
+ processor.visitField(field, type);
+ fail();
+ } catch (IllegalCallbackReferenceException e) {
+ // expected
+ }
+ }
+
+ public void testBadCallbackInterfaceAnnotation() throws Exception {
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ try {
+ processor.visitClass(BadFooImpl.class, type);
+ fail();
+ } catch (IntrospectionException e) {
+ // expected
+ assertTrue(e.getCause() instanceof InvalidCallbackException);
+ }
+ }
+
+ @Callback(FooCallback.class)
+ private interface Foo {
+
+ }
+
+ private interface FooCallback {
+
+ }
+
+ @Service(Foo.class)
+ private static class FooImpl implements Foo {
+
+ @Callback
+ protected FooCallback callback;
+
+ @Callback
+ public void setCallback(FooCallback cb) {
+
+ }
+ }
+
+ private static class BadBarImpl implements Foo {
+ @Callback
+ protected String wrongInterfaceCallback;
+
+ @Callback
+ public void setWrongInterfaceCallback(String cb) {
+
+ }
+
+ @Callback
+ public void setNoParamCallback() {
+
+ }
+
+ }
+
+ @Callback
+ private interface BadFoo {
+
+ }
+
+ @Service(BadFoo.class)
+ private static class BadFooImpl implements BadFoo {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java
new file mode 100644
index 0000000000..f905be7dc8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.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.sca.implementation.java.introspect.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessorTestCase extends TestCase {
+ private ServiceProcessor processor;
+ private JavaImplementation type;
+
+ public void testMultipleInterfaces() throws Exception {
+ processor.visitClass(FooMultiple.class, type);
+ assertEquals(2, type.getServices().size());
+ org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, Baz.class.getSimpleName());
+ assertEquals(Baz.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
+ assertEquals(Bar.class, ((JavaInterface)service.getInterfaceContract().getCallbackInterface()).getJavaClass());
+ assertNotNull(ModelHelper.getService(type, Bar.class.getSimpleName()));
+ }
+
+ public void testSingleInterfaces() throws Exception {
+ processor.visitClass(FooSingle.class, type);
+ assertEquals(1, type.getServices().size());
+ assertNotNull(ModelHelper.getService(type, Baz.class.getSimpleName()));
+ }
+
+ public void testMultipleNoService() throws Exception {
+ processor.visitClass(FooMultipleNoService.class, type);
+ assertEquals(0, type.getServices().size());
+ }
+
+ /**
+ * Verifies a service with a callback annotation is recognized
+ */
+ public void testMultipleWithCallbackAnnotation() throws Exception {
+ processor.visitClass(FooMultipleWithCalback.class, type);
+ assertEquals(1, type.getServices().size());
+ }
+
+ public void testRemotableNoService() throws Exception {
+ processor.visitClass(FooRemotableNoService.class, type);
+ assertEquals(1, type.getServices().size());
+ org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, BazRemotable.class.getSimpleName());
+ assertEquals(BazRemotable.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
+ }
+
+ public void testNonInterface() throws Exception {
+ try {
+ processor.visitClass(BadImpl.class, type);
+ fail();
+ } catch (InvalidServiceType e) {
+ //expected
+ }
+ }
+
+ public void testNoInterfaces() throws Exception {
+ try {
+ processor.visitClass(BadDefinition.class, type);
+ fail();
+ } catch (IllegalServiceDefinitionException e) {
+ //expected
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ ExtensibleJavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory(), introspector);
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ type = javaImplementationFactory.createJavaImplementation();
+ }
+
+ @Callback(Bar.class)
+ private interface Baz {
+ }
+
+ private interface Bar {
+ }
+
+ private interface Bar2 {
+ }
+
+ @Remotable
+ private interface BazRemotable {
+ }
+
+ @Service(interfaces = {Baz.class, Bar.class})
+ private class FooMultiple implements Baz, Bar {
+
+ }
+
+ @Service(Baz.class)
+ private class FooSingle implements Baz, Bar {
+
+ }
+
+ private class FooMultipleNoService implements Bar, Bar2 {
+
+ }
+
+ private class FooMultipleWithCalback implements Baz, Bar {
+
+ }
+
+ private class FooRemotableNoService implements BazRemotable, Bar {
+
+ }
+
+ @Service(FooSingle.class)
+ private class BadImpl extends FooSingle {
+
+ }
+
+
+ @Service()
+ private class BadDefinition extends FooSingle {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..64ba0667f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.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.implementation.java.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospector;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ JavaClassIntrospector classIntrospector = new ExtensibleJavaClassIntrospector(new DefaultJavaClassIntrospectorExtensionPoint());
+
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ staxProcessors.addArtifactProcessor(compositeProcessor);
+
+ JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(assemblyFactory, policyFactory, javaImplementationFactory, classIntrospector);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ }
+
+ public void testReadAndResolveComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
+ staxProcessor.resolve(composite, resolver);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java
new file mode 100644
index 0000000000..a19c7def04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.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.implementation.java.xml;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+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>();
+
+ private WeakReference<ClassLoader> classLoader;
+
+ public TestModelResolver(ClassLoader classLoader) {
+ this.classLoader = new WeakReference<ClassLoader>(classLoader);
+ }
+
+ 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 if (unresolved instanceof ClassReference) {
+
+ // Load a class on demand
+ ClassReference classReference = (ClassReference)unresolved;
+ Class clazz;
+ try {
+ clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
+ } catch (ClassNotFoundException e) {
+
+ // Return the unresolved object
+ return unresolved;
+ }
+
+ // Store a new ClassReference wrappering the loaded class
+ resolved = new ClassReference(clazz);
+ map.put(resolved, resolved);
+
+ // Return the resolved ClassReference
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..bbac819bc9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.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.implementation.java.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+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.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
+import org.apache.tuscany.sca.implementation.java.introspect.JavaClassIntrospector;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing Java implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
+ JavaClassIntrospector classIntrospector = new ExtensibleJavaClassIntrospector(new DefaultJavaClassIntrospectorExtensionPoint());
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ JavaImplementationProcessor javaProcessor = new JavaImplementationProcessor(factory, policyFactory, javaImplementationFactory, classIntrospector);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
new file mode 100644
index 0000000000..7d2f71176b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
@@ -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:calc="http://sample.calculator"
+ targetNamespace="http://sample.calculator"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.pmd
new file mode 100644
index 0000000000..aa1ce3e754
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.pmd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/.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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/pom.xml
new file mode 100644
index 0000000000..58ad08b739
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-implementation-java</artifactId>
+ <name>Apache Tuscany Java Implementation Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java
new file mode 100644
index 0000000000..e67fa9a691
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.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.implementation.java;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BaseJavaImplementation extends Implementation {
+
+ /**
+ * Returns the name of the Java implementation class.
+ *
+ * @return the name of the Java implementation class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java implementation class.
+ *
+ * @param className the name of the Java implementation class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java implementation class.
+ *
+ * @return the Java implementation class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java implementation class.
+ *
+ * @param javaClass the Java implementation class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java
new file mode 100644
index 0000000000..7b849f9b47
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.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.implementation.java;
+
+/**
+ * A factory for the Java model.
+ */
+import org.apache.tuscany.sca.implementation.java.impl.JavaImplementationFactoryImpl;
+
+public class DefaultJavaImplementationFactory extends JavaImplementationFactoryImpl implements JavaImplementationFactory {
+
+ public DefaultJavaImplementationFactory() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
new file mode 100644
index 0000000000..7cda27be66
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.implementation.java;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementation extends BaseJavaImplementation {
+
+ /**
+ * Returns the constructor used to instantiate implementation instances.
+ *
+ * @return the constructor used to instantiate implementation instances
+ */
+ public JavaConstructorImpl<?> getConstructor();
+
+ /**
+ * Sets the constructor used to instantiate implementation instances
+ *
+ * @param definition the constructor used to instantiate implementation instances
+ */
+ public void setConstructor(JavaConstructorImpl<?> definition);
+
+ /**
+ * Returns the component initializer method.
+ *
+ * @return the component initializer method
+ */
+ public Method getInitMethod();
+
+ /**
+ * Sets the component initializer method.
+ *
+ * @param initMethod the component initializer method
+ */
+ public void setInitMethod(Method initMethod);
+
+ /**
+ * Returns the component destructor method.
+ *
+ * @return the component destructor method
+ */
+ public Method getDestroyMethod();
+
+ /**
+ * Sets the component destructor method.
+ *
+ * @param destroyMethod the component destructor method
+ */
+ public void setDestroyMethod(Method destroyMethod);
+
+ /**
+ * Returns the resources injected into this implementation.
+ *
+ * @return
+ */
+ public Map<String, JavaResourceImpl> getResources();
+
+ /**
+ * Returns the Java member used to inject a conversation ID.
+ *
+ * @return
+ */
+ public Member getConversationIDMember();
+
+ /**
+ * Sets the Java member used to inject a conversation ID.
+ *
+ * @param conversationIDMember
+ */
+ public void setConversationIDMember(Member conversationIDMember);
+
+ /**
+ * Returns true if AllowsPassReference is set.
+ *
+ * @return true if AllowsPassByReference is set
+ */
+ public boolean isAllowsPassByReference();
+
+ /**
+ * @param allowsPassByReference the allowsPassByReference to set
+ */
+ public void setAllowsPassByReference(boolean allowsPassByReference);
+
+ /**
+ * @return the allowsPassByReferenceMethods
+ */
+ public List<Method> getAllowsPassByReferenceMethods();
+
+ /**
+ * @param method
+ * @return
+ */
+ public boolean isAllowsPassByReference(Method method);
+
+ /**
+ * @return the constructors
+ */
+ public Map<Constructor, JavaConstructorImpl> getConstructors();
+
+ /**
+ * @return the eagerInit
+ */
+ public boolean isEagerInit();
+
+ /**
+ * @param eagerInit the eagerInit to set
+ */
+ public void setEagerInit(boolean eagerInit);
+
+ /**
+ * @return the callbacks
+ */
+ public Map<String, JavaElementImpl> getCallbackMembers();
+
+ /**
+ * @return the properties
+ */
+ public Map<String, JavaElementImpl> getPropertyMembers();
+
+ /**
+ * @return the references
+ */
+ public Map<String, JavaElementImpl> getReferenceMembers();
+
+ /**
+ * @return the scope
+ */
+ public JavaScopeImpl getJavaScope();
+
+ /**
+ * @param scope the scope to set
+ */
+ public void setJavaScope(JavaScopeImpl scope);
+
+ /**
+ * @return the maxAge
+ */
+ public long getMaxAge();
+
+ /**
+ * @param maxAge the maxAge to set
+ */
+ public void setMaxAge(long maxAge);
+
+ /**
+ * @return the maxIdleTime
+ */
+ public long getMaxIdleTime();
+
+ /**
+ * @param maxIdleTime the maxIdleTime to set
+ */
+ public void setMaxIdleTime(long maxIdleTime);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java
new file mode 100644
index 0000000000..a63e03f832
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.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.implementation.java;
+
+/**
+ * Factory for the Java model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementationFactory {
+
+ /**
+ * Creates a new Java implementation.
+ *
+ * @return
+ */
+ JavaImplementation createJavaImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java
new file mode 100644
index 0000000000..b21c300f37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.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.implementation.java.impl;
+
+import org.apache.tuscany.sca.assembly.impl.ComponentTypeImpl;
+import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseJavaImplementationImpl extends ComponentTypeImpl implements BaseJavaImplementation {
+
+ private String className;
+ private Class<?> javaClass;
+
+ protected BaseJavaImplementationImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ } else if (javaClass != null) {
+ return javaClass.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ if (this.className == null) {
+ this.className = javaClass.getName();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BaseJavaImplementation) {
+ if (getName() != null) {
+ return getName().equals(((BaseJavaImplementation)obj).getName());
+ } else {
+ return ((BaseJavaImplementation)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java
new file mode 100644
index 0000000000..c0b04b4b4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.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.sca.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * Hold injection information for the constructor used to instantiate a
+ * component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaConstructorImpl<T> {
+
+ private Constructor<T> constructor;
+ private JavaParameterImpl[] parameters;
+
+ public JavaConstructorImpl(Constructor<T> constructor) {
+ this.constructor = constructor;
+ int size = constructor.getParameterTypes().length;
+ parameters = new JavaParameterImpl[size];
+ for (int i = 0; i < size; i++) {
+ parameters[i] = new JavaParameterImpl(constructor, i);
+ }
+ }
+
+ public Constructor<T> getConstructor() {
+ return constructor;
+ }
+
+ /**
+ * @return the parameters
+ */
+ public JavaParameterImpl[] getParameters() {
+ return parameters;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
new file mode 100644
index 0000000000..61c9a4bd43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+
+/**
+ * This class represents a java element such as a Package, Class, Constructor,
+ * Field, Method or Parameter.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaElementImpl {
+ private AnnotatedElement anchor;
+ private ElementType elementType;
+ private Class<?> type;
+ private Type genericType;
+ private int index = -1;
+ private String name;
+ private Class<? extends Annotation> classifer;
+
+ public JavaElementImpl(Package pkg) {
+ this.anchor = pkg;
+ this.elementType = ElementType.PACKAGE;
+ this.name = pkg.getName();
+ }
+
+ public JavaElementImpl(Class<?> cls) {
+ this.anchor = cls;
+ this.elementType = ElementType.TYPE;
+ this.type = cls;
+ this.genericType = cls;
+ this.name = cls.getName();
+ }
+
+ public JavaElementImpl(Field field) {
+ this.anchor = field;
+ this.elementType = ElementType.FIELD;
+ this.type = field.getType();
+ this.genericType = field.getGenericType();
+ this.name = field.getName();
+ }
+
+ public JavaElementImpl(Constructor<?> constructor, int index) {
+ this.anchor = constructor;
+ this.elementType = ElementType.PARAMETER;
+ this.type = constructor.getParameterTypes()[index];
+ this.genericType = constructor.getGenericParameterTypes()[index];
+ this.index = index;
+ this.name = "";
+ }
+
+ public JavaElementImpl(Method method, int index) {
+ this.anchor = method;
+ this.elementType = ElementType.PARAMETER;
+ this.type = method.getParameterTypes()[index];
+ this.genericType = method.getGenericParameterTypes()[index];
+ this.index = index;
+ this.name = "";
+ }
+
+ /**
+ * For testing purpose
+ *
+ * @param name
+ * @param type
+ * @param classifer TODO
+ * @param elementType
+ */
+ public JavaElementImpl(String name, Class<?> type, Class<? extends Annotation> classifer) {
+ super();
+ this.type = type;
+ this.name = name;
+ this.classifer = classifer;
+ }
+
+ /**
+ * @return the anchor
+ */
+ public AnnotatedElement getAnchor() {
+ return anchor;
+ }
+
+ /**
+ * @return the elementType
+ */
+ public ElementType getElementType() {
+ return elementType;
+ }
+
+ /**
+ * @return the genericType
+ */
+ public Type getGenericType() {
+ return genericType;
+ }
+
+ /**
+ * @return the index
+ */
+ public int getIndex() {
+ return index;
+ }
+
+ /**
+ * @return the type
+ */
+ public Class<?> getType() {
+ return type;
+ }
+
+ public Annotation[] getAnnotations() {
+ if (elementType == ElementType.PARAMETER) {
+ if (anchor instanceof Method) {
+ // We only care about the method-level annotaions
+ return ((Method)anchor).getAnnotations();
+ }
+ if (anchor instanceof Constructor) {
+ return ((Constructor)anchor).getParameterAnnotations()[index];
+ }
+ }
+ return anchor.getAnnotations();
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
+ for (Annotation a : getAnnotations()) {
+ if (a.annotationType() == annotationType) {
+ return annotationType.cast(a);
+ }
+ }
+ return null;
+ }
+
+ public String toString() {
+ return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : "");
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode());
+ result = PRIME * result + index;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final JavaElementImpl other = (JavaElementImpl)obj;
+ if (anchor == null) {
+ if (other.anchor != null) {
+ return false;
+ }
+ } else if (!anchor.equals(other.anchor)) {
+ return false;
+ }
+ if (index != other.index) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return the classifer
+ */
+ public Class<? extends Annotation> getClassifer() {
+ return classifer;
+ }
+
+ /**
+ * @param classifer the classifer to set
+ */
+ public void setClassifer(Class<? extends Annotation> classifer) {
+ this.classifer = classifer;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java
new file mode 100644
index 0000000000..f7174e3868
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.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.implementation.java.impl;
+
+/**
+ * A factory for the Java model.
+ */
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+
+public abstract class JavaImplementationFactoryImpl implements JavaImplementationFactory {
+
+ public JavaImplementation createJavaImplementation() {
+ JavaImplementation javaImplementation = new JavaImplementationImpl();
+ return javaImplementation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
new file mode 100644
index 0000000000..e3de20b2de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+
+/**
+ * A component type specialization for POJO implementations
+ *
+ * @version $$Rev$$ $$Date$$
+ */
+public class JavaImplementationImpl extends BaseJavaImplementationImpl implements JavaImplementation {
+ private JavaConstructorImpl<?> constructorDefinition;
+ private Map<Constructor, JavaConstructorImpl> constructors = new HashMap<Constructor, JavaConstructorImpl>();
+ private Method initMethod;
+ private Method destroyMethod;
+ private final Map<String, JavaResourceImpl> resources = new HashMap<String, JavaResourceImpl>();
+ private final Map<String, JavaElementImpl> propertyMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> referenceMembers = new HashMap<String, JavaElementImpl>();
+ private final Map<String, JavaElementImpl> callbackMembers = new HashMap<String, JavaElementImpl>();
+ private Member conversationIDMember;
+ private boolean eagerInit;
+ private boolean allowsPassByReference;
+ private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
+ private long maxAge = -1;
+ private long maxIdleTime = -1;
+ private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
+
+ protected JavaImplementationImpl() {
+ super();
+ }
+
+ public JavaConstructorImpl<?> getConstructor() {
+ return constructorDefinition;
+ }
+
+ public void setConstructor(JavaConstructorImpl<?> definition) {
+ this.constructorDefinition = definition;
+ }
+
+ public Method getInitMethod() {
+ return initMethod;
+ }
+
+ public void setInitMethod(Method initMethod) {
+ this.initMethod = initMethod;
+ }
+
+ public Method getDestroyMethod() {
+ return destroyMethod;
+ }
+
+ public void setDestroyMethod(Method destroyMethod) {
+ this.destroyMethod = destroyMethod;
+ }
+
+ public Map<String, JavaResourceImpl> getResources() {
+ return resources;
+ }
+
+ public Member getConversationIDMember() {
+ return this.conversationIDMember;
+ }
+
+ public void setConversationIDMember(Member conversationIDMember) {
+ this.conversationIDMember = conversationIDMember;
+ }
+
+ public boolean isAllowsPassByReference() {
+ return allowsPassByReference;
+ }
+
+ public void setAllowsPassByReference(boolean allowsPassByReference) {
+ this.allowsPassByReference = allowsPassByReference;
+ }
+
+ public List<Method> getAllowsPassByReferenceMethods() {
+ return allowsPassByReferenceMethods;
+ }
+
+ public boolean isAllowsPassByReference(Method method) {
+ return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
+ }
+
+ public Map<Constructor, JavaConstructorImpl> getConstructors() {
+ return constructors;
+ }
+
+ public boolean isEagerInit() {
+ return eagerInit;
+ }
+
+ public void setEagerInit(boolean eagerInit) {
+ this.eagerInit = eagerInit;
+ }
+
+ public Map<String, JavaElementImpl> getCallbackMembers() {
+ return callbackMembers;
+ }
+
+ public Map<String, JavaElementImpl> getPropertyMembers() {
+ return propertyMembers;
+ }
+
+ public Map<String, JavaElementImpl> getReferenceMembers() {
+ return referenceMembers;
+ }
+
+ public JavaScopeImpl getJavaScope() {
+ return scope;
+ }
+
+ public void setJavaScope(JavaScopeImpl scope) {
+ this.scope = scope;
+ }
+
+ public long getMaxAge() {
+ return maxAge;
+ }
+
+ public void setMaxAge(long maxAge) {
+ this.maxAge = maxAge;
+ }
+
+ public long getMaxIdleTime() {
+ return maxIdleTime;
+ }
+
+ public void setMaxIdleTime(long maxIdleTime) {
+ this.maxIdleTime = maxIdleTime;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java
new file mode 100644
index 0000000000..c4c528f4f2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.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.implementation.java.impl;
+
+import java.lang.reflect.Constructor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaParameterImpl extends JavaElementImpl {
+ /**
+ * @param constructor
+ * @param index
+ */
+ public JavaParameterImpl(Constructor<?> constructor, int index) {
+ super(constructor, index);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java
new file mode 100644
index 0000000000..1aca15ebb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.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.implementation.java.impl;
+
+
+/**
+ * A resource dependency declared by a Java component implementation
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaResourceImpl {
+ private JavaElementImpl element;
+ private String mappedName;
+ private boolean optional;
+
+ public JavaResourceImpl(JavaElementImpl element) {
+ this.element = element;
+ }
+
+ /**
+ * The name of the resource
+ *
+ * @return the name of the resource
+ */
+ public String getName() {
+ return element.getName();
+ }
+
+ /**
+ * Returns the URI of the resource
+ *
+ * @return the URI of the resource
+ */
+ public String getMappedName() {
+ return mappedName;
+ }
+
+ /**
+ * Sets the resource URI
+ */
+ public void setMappedName(String mappedName) {
+ this.mappedName = mappedName;
+ }
+
+ /**
+ * If true, the resource is optional
+ *
+ * @return true if the resource is optional
+ */
+ public boolean isOptional() {
+ return optional;
+ }
+
+ /**
+ * Sets whether the resource is optional
+ */
+ public void setOptional(boolean optional) {
+ this.optional = optional;
+ }
+
+ /**
+ * @return the element
+ */
+ public JavaElementImpl getElement() {
+ return element;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java
new file mode 100644
index 0000000000..7683bbb154
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.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.implementation.java.impl;
+
+/**
+ * The default implementation scopes supported by assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaScopeImpl {
+ public static final JavaScopeImpl STATELESS = new JavaScopeImpl("STATELESS");
+ public static final JavaScopeImpl REQUEST = new JavaScopeImpl("REQUEST");
+ public static final JavaScopeImpl SESSION = new JavaScopeImpl("SESSION");
+ public static final JavaScopeImpl CONVERSATION = new JavaScopeImpl("CONVERSATION");
+ public static final JavaScopeImpl COMPOSITE = new JavaScopeImpl("COMPOSITE");
+ public static final JavaScopeImpl SYSTEM = new JavaScopeImpl("SYSTEM");
+ public static final JavaScopeImpl UNDEFINED = new JavaScopeImpl("UNDEFINED");
+
+ private String scope;
+
+ public JavaScopeImpl(String scope) {
+ this.scope = scope.toUpperCase().intern();
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ final JavaScopeImpl scope1 = (JavaScopeImpl) o;
+ return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
+ }
+
+ public int hashCode() {
+ return scope != null ? scope.hashCode() : 0;
+ }
+
+ public String toString() {
+ return scope;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/LICENSE
new file mode 100644
index 0000000000..4b5ab74408
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/LICENSE
@@ -0,0 +1,251 @@
+
+ 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 SCA for Java Subcomponents
+=========================================:
+
+The Tuscany SCA for Java release includes a number of subcomponents with
+separate copyright notices and license terms. Your use of the source
+code for the these subcomponents is subject to the terms and
+conditions of the following licenses.
+
+=================================================================================================================
+
+This module implementation-script temporarily includes one file under the following BSD license:
+
+ Copyright (c) 2006, Sun Microsystems, 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:
+
+ - Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ - 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.
+
+ - Neither the name of the Sun Microsystems, Inc. nor the names of
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ CONTRIBUTORS "AS IS" AND ANY EXPRESS 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
+ COPYRIGHT OWNER OR 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.
+
+=================================================================================================================
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/NOTICE
new file mode 100644
index 0000000000..9a03eabdab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/NOTICE
@@ -0,0 +1,17 @@
+${pom.name}
+Copyright (c) 2005 - 2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Unless otherwise indicated, all distribution made available by the Apache Software Foundation
+is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
+A copy of the AL is provided with this distribution as the LICENSE file present in the
+root directory, and is also available at http://www.apache.org/licenses/.
+
+This product also includes software under the BSD license
+(see the LICENSE file contained in this distribution), with
+the following copyright:
+
+Copyright (c) 2006, Sun Microsystems, Inc.
+All rights reserved.
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/pom.xml
new file mode 100644
index 0000000000..23b2ed27d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>tuscany-implementation-script</artifactId>
+ <name>Apache Tuscany Implementation Script</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.bsf</groupId>
+ <artifactId>bsf-all</artifactId>
+ <version>3.0-beta1</version>
+ </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>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</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>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ </exclusion>
+ </exclusions>
+ <version>1.0RC2</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>2.2-beta1</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/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractImplementation.java
new file mode 100644
index 0000000000..3b7b7fdbdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractImplementation.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.implementation.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * TODO: couldn't something like this class be provided by the runtime?
+ */
+public abstract class AbstractImplementation implements Implementation {
+
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private List<Property> properties = new ArrayList<Property>();
+ private ConstrainingType constrainingType;
+ private String uri;
+ private boolean unresolved = true;
+ private List<Intent> intents;
+ private List<PolicySet> policySets;
+
+ public AbstractImplementation() {
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return intents;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Object> getExtensions() {
+ // TODO what is this for?
+ return null;
+ }
+
+ public boolean isUnresolved() {
+ // TODO what is this for?
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // TODO what is this for?
+ this.unresolved = unresolved;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractStAXArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractStAXArtifactProcessor.java
new file mode 100644
index 0000000000..275b0ff0a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/AbstractStAXArtifactProcessor.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.implementation.spi;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+
+/**
+ * TODO: couldn't something like this class be provided by the runtime?
+ * Each impl shouldn't have to have their own .componentType merging code
+ */
+public abstract class AbstractStAXArtifactProcessor<I extends Implementation> implements StAXArtifactProcessor<I> {
+
+ private AssemblyFactory assemblyFactory;
+
+ public AbstractStAXArtifactProcessor(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public void resolve(I model, ModelResolver resolver) throws ContributionResolveException {
+ addSideFileComponentType(model.getURI(), model, resolver);
+ model.setUnresolved(false);
+ }
+
+ protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
+ int lastDot = name.lastIndexOf('.');
+ if (lastDot < 0) {
+ return;
+ }
+ String sideFileName = name.substring(0, lastDot) + ".componentType";
+
+ ComponentType componentType = assemblyFactory.createComponentType();
+ componentType.setURI(sideFileName);
+ componentType.setUnresolved(true);
+
+ componentType = resolver.resolveModel(ComponentType.class, componentType);
+
+ if (!componentType.isUnresolved()) {
+ for (Reference reference : componentType.getReferences()) {
+ impl.getReferences().add(reference);
+ }
+ for (Service service : componentType.getServices()) {
+ impl.getServices().add(service);
+ }
+ for (Property property : componentType.getProperties()) {
+ impl.getProperties().add(property);
+ }
+ if (componentType.getConstrainingType() != null) {
+ impl.setConstrainingType(componentType.getConstrainingType());
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/PropertyValueObjectFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/PropertyValueObjectFactory.java
new file mode 100644
index 0000000000..53385f55b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/PropertyValueObjectFactory.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.implementation.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.databinding.Mediator;
+import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
+import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * TODO: Shouldn't this class be provided by the runtime?
+ */
+public class PropertyValueObjectFactory {
+ // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
+ protected Mediator mediator = null;
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ boolean isSimpleType;
+
+ public PropertyValueObjectFactory(Mediator mediator) {
+ this.mediator = mediator;
+ }
+
+ public ObjectFactory createValueFactory(Property property) {
+ isSimpleType = isSimpleType(property);
+ Document doc = (Document)property.getValue();
+ Element rootElement = doc.getDocumentElement();
+
+ //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the
+ //xml structure of the property value. Should this be done in the JavaBeansDataBinding...
+ Class javaType = null;
+
+ if (property.isMany()) {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ List<String> values =
+ getSimplePropertyValues(value, javaType);
+ return new ListObjectFactoryImpl(property,
+ values,
+ isSimpleType,
+ javaType);
+ } else {
+ return new ListObjectFactoryImpl(property,
+ getComplexPropertyValues(doc),
+ isSimpleType,
+ javaType);
+ }
+ } else {
+ if (isSimpleType) {
+ String value = "";
+ if (rootElement.getChildNodes().getLength() > 0) {
+ value = rootElement.getChildNodes().item(0).getTextContent();
+ }
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ } else {
+ Object value = getComplexPropertyValues(doc).get(0);
+ return new ObjectFactoryImpl(property,
+ value,
+ isSimpleType,
+ javaType);
+ }
+
+ }
+ }
+
+ private boolean isSimpleType(Property property) {
+ if (property.getXSDType() != null) {
+ return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+ } else {
+ if (property instanceof Document) {
+ Document doc = (Document)property;
+ Element element = doc.getDocumentElement();
+ if (element.getChildNodes().getLength() == 1 &&
+ element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
+ List<String> propValues = new ArrayList<String>();
+ StringTokenizer st = null;
+ if ( javaType.getName().equals("java.lang.String")) {
+ st = new StringTokenizer(concatenatedValue, "\"");
+ } else {
+ st = new StringTokenizer(concatenatedValue);
+ }
+ String aToken = null;
+ while (st.hasMoreTokens()) {
+ aToken = st.nextToken();
+ if (aToken.trim().length() > 0) {
+ propValues.add(aToken);
+ }
+ }
+ return propValues;
+ }
+
+ private List<Node> getComplexPropertyValues(Document document) {
+ Element rootElement = document.getDocumentElement();
+ List<Node> propValues = new ArrayList<Node>();
+ for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
+ if (rootElement.getChildNodes().item(count).getNodeType() == Document.ELEMENT_NODE) {
+ propValues.add(rootElement.getChildNodes().item(count));
+ }
+ }
+ return propValues;
+ }
+
+ public abstract class ObjectFactoryImplBase implements ObjectFactory {
+ protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
+ protected Property property;
+ protected Object propertyValue;
+ protected Class javaType;
+ protected DataType<XMLType> sourceDataType;
+ protected DataType<?> targetDataType;
+ boolean isSimpleType;
+
+ public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+
+ this.isSimpleType = isSimpleType;
+ this.property = property;
+ this.propertyValue = propertyValue;
+ this.javaType = javaType;
+ //FIXME : fix this when we have managed to generate dynamic java types
+ /*sourceDataType =
+ new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
+ new XMLType(null, this.property.getXSDType()));
+ TypeInfo typeInfo = null;
+ if (this.property.getXSDType() != null) {
+ if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) {
+ typeInfo = new TypeInfo(property.getXSDType(), true, null);
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+ } else {
+ typeInfo = new TypeInfo(property.getXSDType(), false, null);
+ }
+
+ XMLType xmlType = new XMLType(typeInfo);
+ String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
+ if (dataBinding != null) {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ } else {
+ targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
+ mediator.getDataBindingRegistry().introspectType(targetDataType, null);
+ }*/
+ }
+ }
+
+ public class ObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+ super(property, propertyValue, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
+ } else {
+ return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
+ //return null;
+ }
+ }
+ }
+
+ public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+ public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
+ super(property, propertyValues, isSimpleType, javaType);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<?> getInstance() throws ObjectCreationException {
+ if (isSimpleType) {
+ List<Object> values = new ArrayList<Object>();
+ for (String aValue : (List<String>)propertyValue) {
+ values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
+ }
+ return values;
+ } else {
+ List instances = new ArrayList();
+ for (Node aValue : (List<Node>)propertyValue) {
+ instances.add(mediator.mediate(aValue,
+ sourceDataType,
+ targetDataType,
+ null));
+ }
+ return instances;
+ }
+ }
+ }
+}
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/ResourceHelper.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/ResourceHelper.java
new file mode 100644
index 0000000000..ed2efb64bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/implementation/spi/ResourceHelper.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.implementation.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * TODO: Shouldn't this be using the contrabution service?
+ */
+public class ResourceHelper {
+
+ public static String readResource(String scriptName) throws ContributionReadException {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ URL scriptSrcUrl = cl.getResource(scriptName);
+ if (scriptSrcUrl == null) {
+ throw new ContributionReadException("No script: " + scriptName);
+ }
+
+ InputStream is;
+ try {
+ is = scriptSrcUrl.openStream();
+ } catch (IOException e) {
+ throw new ContributionReadException(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 ContributionReadException(e);
+ } finally {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptArtifactProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptArtifactProcessor.java
new file mode 100644
index 0000000000..731ab2f5d0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptArtifactProcessor.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.implementation.script;
+
+import static javax.xml.stream.XMLStreamConstants.END_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.implementation.spi.AbstractStAXArtifactProcessor;
+import org.apache.tuscany.implementation.spi.ResourceHelper;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+
+/**
+ * ArtifactProcessor to read the SCDL XML for script implementations
+ *
+ * <code><implementation.script script="pathToScriptFile" [language="scriptLanguage"] /></code>
+ */
+public class ScriptArtifactProcessor extends AbstractStAXArtifactProcessor<ScriptImplementation> {
+
+ private static final QName IMPLEMENTATION_SCRIPT_QNAME = new QName(Constants.SCA10_NS, "implementation.script");
+
+ public ScriptArtifactProcessor(AssemblyFactory assemblyFactory) {
+ super(assemblyFactory);
+ }
+
+ public QName getArtifactType() {
+ return IMPLEMENTATION_SCRIPT_QNAME;
+ }
+
+ public Class<ScriptImplementation> getModelType() {
+ return ScriptImplementation.class;
+ }
+
+ public ScriptImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ String scriptName = reader.getAttributeValue(null, "script");
+
+ String scriptLanguage = reader.getAttributeValue(null, "language");
+ if (scriptLanguage == null || scriptLanguage.length() < 1) {
+ int i = scriptName.lastIndexOf('.');
+ scriptLanguage = scriptName.substring(i+1);
+ }
+
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_SCRIPT_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ String scriptSrc = ResourceHelper.readResource(scriptName);
+ ScriptImplementation scriptImpl = new ScriptImplementation(scriptName, scriptLanguage, scriptSrc);
+
+ // TODO: How to get the script URI? Should use the contrabution service
+ // the uri is used in the resolve method (perhaps incorrectly?) to get the .componentType sidefile
+ scriptImpl.setURI(Thread.currentThread().getContextClassLoader().getResource(scriptName).toString());
+
+ return scriptImpl;
+ }
+
+ public void write(ScriptImplementation scriptImplementation, XMLStreamWriter writer) throws XMLStreamException {
+
+ writer.writeStartElement(Constants.SCA10_NS, "implementation.script");
+
+ if (scriptImplementation.getScriptName() != null) {
+ writer.writeAttribute("script", scriptImplementation.getScriptName());
+ }
+
+ if (scriptImplementation.getScriptLanguage() != null) {
+ writer.writeAttribute("language", scriptImplementation.getScriptLanguage());
+ }
+
+ writer.writeEndElement();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java
new file mode 100644
index 0000000000..3b127e2d41
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.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.implementation.script;
+
+import org.apache.tuscany.implementation.spi.AbstractImplementation;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Represents a Script implementation.
+ */
+public class ScriptImplementation extends AbstractImplementation implements Implementation {
+
+ protected String scriptName;
+ protected String scriptSrc;
+ protected String scriptLanguage;
+
+ public ScriptImplementation(String scriptName, String scriptLanguage, String scriptSrc) {
+ this.scriptName = scriptName;
+ this.scriptLanguage = scriptLanguage;
+ this.scriptSrc = scriptSrc;
+ }
+
+ public String getScriptName() {
+ return scriptName;
+ }
+
+ public String getScriptLanguage() {
+ return scriptLanguage;
+ }
+
+ public String getScriptSrc() {
+ return scriptSrc;
+ }
+
+ public void setScriptSrc(String scriptSrc) {
+ this.scriptSrc = scriptSrc;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProvider.java
new file mode 100644
index 0000000000..b15247033b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProvider.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.sca.implementation.script;
+
+import java.io.StringReader;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.implementation.spi.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.assembly.ComponentReference;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+import org.apache.tuscany.sca.implementation.script.engines.TuscanyJRubyScriptEngine;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * Represents a Script implementation.
+ */
+public class ScriptImplementationProvider implements ImplementationProvider {
+
+ protected RuntimeComponent component;
+ protected ScriptImplementation implementation;
+ protected ScriptEngine scriptEngine;
+ protected PropertyValueObjectFactory propertyFactory;
+
+ public ScriptImplementationProvider(RuntimeComponent component, ScriptImplementation implementation, PropertyValueObjectFactory propertyFactory) {
+ this.component = component;
+ this.implementation = implementation;
+ this.propertyFactory = propertyFactory;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ return new ScriptInvoker(this, operation.getName());
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ return new ScriptInvoker(this, operation.getName());
+ }
+
+ public void start() {
+ try {
+ scriptEngine = getScriptEngineByExtension(implementation.getScriptLanguage());
+ if (scriptEngine == null) {
+ throw new ObjectCreationException("no script engine found for language: " + implementation.getScriptLanguage());
+ }
+ if (!(scriptEngine instanceof Invocable)) {
+ throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine);
+ }
+
+ for (Reference reference : implementation.getReferences()) {
+ scriptEngine.put(reference.getName(), createReferenceProxy(reference.getName(), component));
+ }
+
+ for (Property property : implementation.getProperties()) {
+ ObjectFactory<?> propertyValueFactory = propertyFactory.createValueFactory(property);
+ if ( propertyValueFactory != null) {
+ scriptEngine.put(property.getName(), propertyValueFactory.getInstance());
+ }
+ }
+
+ scriptEngine.eval(new StringReader(implementation.getScriptSrc()));
+
+ } catch (ScriptException e) {
+ throw new ObjectCreationException(e);
+ }
+ }
+
+ public void stop() {
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Object createReferenceProxy(String name, RuntimeComponent component) {
+ for (ComponentReference reference : component.getReferences()) {
+ if (reference.getName().equals(name)) {
+ Class iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
+ return component.getService(iface, name);
+ }
+ }
+ throw new IllegalArgumentException("reference " + name + " not found on component: " + component);
+ }
+
+ /**
+ * Hack for now to work around a problem with the JRuby script engine
+ */
+ private ScriptEngine getScriptEngineByExtension(String scriptExtn) {
+ ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
+ if ("rb".equals(scriptExtn)) {
+ return new TuscanyJRubyScriptEngine();
+ } else {
+ return scriptEngineManager.getEngineByExtension(scriptExtn);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProviderFactory.java
new file mode 100644
index 0000000000..a41f8ce3e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationProviderFactory.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.sca.implementation.script;
+
+import org.apache.tuscany.implementation.spi.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * Represents a Script implementation.
+ */
+public class ScriptImplementationProviderFactory implements ImplementationProviderFactory<ScriptImplementation> {
+
+ private PropertyValueObjectFactory propertyFactory;
+
+ public ScriptImplementationProviderFactory(PropertyValueObjectFactory propertyFactory) {
+ this.propertyFactory = propertyFactory;
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, ScriptImplementation implementation) {
+ return new ScriptImplementationProvider(component, implementation, propertyFactory);
+ }
+
+ public Class<ScriptImplementation> getModelType() {
+ return ScriptImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java
new file mode 100644
index 0000000000..4b75cf3a92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.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.sca.implementation.script;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.script.Invocable;
+import javax.script.ScriptException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Perform the actual script invocation
+ */
+public class ScriptInvoker implements Invoker {
+
+ protected ScriptImplementationProvider provider;
+ protected String operationName;
+
+ /**
+ * TODO: passing in the impl is a bit of a hack to get at scriptEngine as thats all this uses
+ * but its not created till the start method which is called after the invokers are created
+ */
+ public ScriptInvoker(ScriptImplementationProvider provider, String operationName) {
+ this.provider = provider;
+ this.operationName = operationName;
+ }
+
+ private Object doInvoke(Object[] objects) throws InvocationTargetException {
+ try {
+
+ return ((Invocable)provider.scriptEngine).invokeFunction(operationName, objects);
+
+ } catch (ScriptException e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = doInvoke((Object[])msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptModuleActivator.java
new file mode 100644
index 0000000000..9a928a9065
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptModuleActivator.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.implementation.script;
+
+import org.apache.tuscany.implementation.spi.PropertyValueObjectFactory;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+public class ScriptModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+
+ StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ StAXArtifactProcessor scriptArtifactProcessor = new ScriptArtifactProcessor(assemblyFactory);
+ staxProcessors.addArtifactProcessor(scriptArtifactProcessor);
+
+ // TODO: could the runtime have a default PropertyValueObjectFactory in the registry
+ DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ PropertyValueObjectFactory propertyFactory = new PropertyValueObjectFactory(mediator);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new ScriptImplementationProviderFactory(propertyFactory));
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
new file mode 100644
index 0000000000..b1a1b05052
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2006, Sun Microsystems, 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:
+*
+* - Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* - 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.
+*
+* - Neither the name of the Sun Microsystems, Inc. nor the names of
+* contributors may be used to endorse or promote products derived from this
+* software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+* CONTRIBUTORS "AS IS" AND ANY EXPRESS 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
+* COPYRIGHT OWNER OR 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.
+*/
+package org.apache.tuscany.sca.implementation.script.engines;
+
+import java.io.File;
+import java.io.Reader;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.script.AbstractScriptEngine;
+import javax.script.Bindings;
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.Invocable;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+
+import org.jruby.Ruby;
+import org.jruby.ast.Node;
+import org.jruby.internal.runtime.GlobalVariable;
+import org.jruby.internal.runtime.GlobalVariables;
+import org.jruby.internal.runtime.ReadonlyAccessor;
+import org.jruby.javasupport.Java;
+import org.jruby.javasupport.JavaObject;
+import org.jruby.javasupport.JavaUtil;
+import org.jruby.runtime.Block;
+import org.jruby.runtime.IAccessor;
+import org.jruby.runtime.builtin.IRubyObject;
+
+import com.sun.script.jruby.JRubyScriptEngineFactory;
+
+/*
+ * This class is a copy of the class com.sun.script.ruby.JRubyScriptEngine with some minor modifications
+ * to work around problems with Tuscany setting SCA properties and references as global variable in JRuby
+ * Should only need it temporarily till a new BSF release fixes it.
+ */
+@SuppressWarnings("unchecked")
+public class TuscanyJRubyScriptEngine extends AbstractScriptEngine
+ implements Compilable, Invocable {
+
+ // my factory, may be null
+ private ScriptEngineFactory factory;
+ private Ruby runtime;
+
+ public TuscanyJRubyScriptEngine() {
+ init(System.getProperty("com.sun.script.jruby.loadpath"));
+ }
+
+ public TuscanyJRubyScriptEngine(String loadPath) {
+ init(loadPath);
+ }
+
+ // my implementation for CompiledScript
+ private class JRubyCompiledScript extends CompiledScript {
+ // my compiled code
+ private Node node;
+
+ JRubyCompiledScript (Node node) {
+ this.node = node;
+ }
+
+ public ScriptEngine getEngine() {
+ return TuscanyJRubyScriptEngine.this;
+ }
+
+ public Object eval(ScriptContext ctx) throws ScriptException {
+ return evalNode(node, ctx);
+ }
+ }
+
+ // Compilable methods
+ public CompiledScript compile(String script)
+ throws ScriptException {
+ Node node = compileScript(script, context);
+ return new JRubyCompiledScript(node);
+ }
+
+ public CompiledScript compile (Reader reader)
+ throws ScriptException {
+ Node node = compileScript(reader, context);
+ return new JRubyCompiledScript(node);
+ }
+
+ // Invocable methods
+ public Object invokeFunction(String name, Object[] args)
+ throws ScriptException {
+ return invokeImpl(null, name, args, Object.class);
+ }
+
+ public Object invokeMethod(Object obj, String name, Object[] args)
+ throws ScriptException {
+ if (obj == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return invokeImpl(obj, name, args, Object.class);
+ }
+
+ public Object getInterface(Object obj, Class clazz) {
+ if (obj == null) {
+ throw new IllegalArgumentException("script object is null");
+ }
+ return makeInterface(obj, clazz);
+ }
+
+ public Object getInterface(Class clazz) {
+ return makeInterface(null, clazz);
+ }
+
+ private <T> T makeInterface(Object obj, Class<T> clazz) {
+ if (clazz == null || !clazz.isInterface()) {
+ throw new IllegalArgumentException("interface Class expected");
+ }
+ final Object thiz = obj;
+ return (T) Proxy.newProxyInstance(
+ clazz.getClassLoader(),
+ new Class[] { clazz },
+ new InvocationHandler() {
+ public Object invoke(Object proxy, Method m, Object[] args)
+ throws Throwable {
+ return invokeImpl(thiz, m.getName(),
+ args, m.getReturnType());
+ }
+ });
+ }
+
+ // ScriptEngine methods
+ public synchronized Object eval(String str, ScriptContext ctx)
+ throws ScriptException {
+ Node node = compileScript(str, ctx);
+ return evalNode(node, ctx);
+ }
+
+ public synchronized Object eval(Reader reader, ScriptContext ctx)
+ throws ScriptException {
+ Node node = compileScript(reader, ctx);
+ return evalNode(node, ctx);
+ }
+
+ public ScriptEngineFactory getFactory() {
+ synchronized (this) {
+ if (factory == null) {
+ factory = new JRubyScriptEngineFactory();
+ }
+ }
+ return factory;
+ }
+
+ public Bindings createBindings() {
+ return new SimpleBindings();
+ }
+
+ // package-private methods
+ void setFactory(ScriptEngineFactory factory) {
+ this.factory = factory;
+ }
+
+ // internals only below this point
+
+ private Object rubyToJava(IRubyObject value) {
+ return rubyToJava(value, Object.class);
+ }
+
+ private Object rubyToJava(IRubyObject value, Class type) {
+ return JavaUtil.convertArgument(
+ Java.ruby_to_java(value, value, Block.NULL_BLOCK),
+ type);
+ }
+
+ private IRubyObject javaToRuby(Object value) {
+ if (value instanceof IRubyObject) {
+ return (IRubyObject) value;
+ }
+ IRubyObject result = JavaUtil.convertJavaToRuby(runtime, value);
+ if (result instanceof JavaObject) {
+ return runtime.getModule("JavaUtilities").callMethod(runtime.getCurrentContext(), "wrap", result);
+ }
+ return result;
+ }
+
+ private synchronized Node compileScript(String script, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
+ if (filename == null) {
+ filename = "<unknown>";
+ }
+ return runtime.parse(script, filename, null);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private synchronized Node compileScript(Reader reader, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
+ if (filename == null) {
+ filename = "<unknown>";
+ }
+ return runtime.parse(reader, filename, null);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private void setGlobalVariables(final ScriptContext ctx) {
+ ctx.setAttribute("context", ctx, ScriptContext.ENGINE_SCOPE);
+ setGlobalVariables(new GlobalVariables(runtime) {
+ GlobalVariables parent = runtime.getGlobalVariables();
+
+ public void define(String name, IAccessor accessor) {
+ assert name != null;
+ assert accessor != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
+ engineScope.put(name, new GlobalVariable(accessor));
+ }
+ }
+
+
+ public void defineReadonly(String name, IAccessor accessor) {
+ assert name != null;
+ assert accessor != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
+ engineScope.put(name, new GlobalVariable(new
+ ReadonlyAccessor(name, accessor)));
+ }
+ }
+
+ public boolean isDefined(String name) {
+ assert name != null;
+ assert name.startsWith("$");
+ synchronized (ctx) {
+ String modifiedName = name.substring(1);
+ boolean defined = ctx.getAttributesScope(modifiedName) != -1;
+ return defined ? true : parent.isDefined(name);
+ }
+ }
+
+ public void alias(String name, String oldName) {
+ assert name != null;
+ assert oldName != null;
+ assert name.startsWith("$");
+ assert oldName.startsWith("$");
+
+ if (runtime.getSafeLevel() >= 4) {
+ throw runtime.newSecurityError("Insecure: can't alias global variable");
+ }
+
+ synchronized (ctx) {
+ int scope = ctx.getAttributesScope(name);
+ if (scope == -1) {
+ scope = ScriptContext.ENGINE_SCOPE;
+ }
+
+ IRubyObject value = get(oldName);
+ ctx.setAttribute(name, rubyToJava(value), scope);
+ }
+ }
+
+ public IRubyObject get(String name) {
+ assert name != null;
+ assert name.startsWith("$");
+
+ synchronized (ctx) {
+ // skip '$' and try
+ String modifiedName = name.substring(1);
+ int scope = ctx.getAttributesScope(modifiedName);
+ if (scope == -1) {
+ return parent.get(name);
+ }
+
+ Object obj = ctx.getAttribute(modifiedName, scope);
+ if (obj instanceof IAccessor) {
+ return ((IAccessor)obj).getValue();
+ } else {
+ return javaToRuby(obj);
+ }
+ }
+ }
+
+ public IRubyObject set(String name, IRubyObject value) {
+ assert name != null;
+ assert name.startsWith("$");
+
+ if (runtime.getSafeLevel() >= 4) {
+ throw runtime.newSecurityError("Insecure: can't change global variable value");
+ }
+
+ synchronized (ctx) {
+ // skip '$' and try
+ String modifiedName = name.substring(1);
+ int scope = ctx.getAttributesScope(modifiedName);
+ if (scope == -1) {
+ scope = ScriptContext.ENGINE_SCOPE;
+ }
+ IRubyObject oldValue = get(name);
+ Object obj = ctx.getAttribute(modifiedName, scope);
+ if (obj instanceof IAccessor) {
+ ((IAccessor)obj).setValue(value);
+ } else {
+ ctx.setAttribute(modifiedName, rubyToJava(value), scope);
+ }
+ return oldValue;
+ }
+ }
+
+ public Iterator getNames() {
+ List list = new ArrayList();
+ synchronized (ctx) {
+ Iterator<Integer> iterator = ctx.getScopes().iterator();
+ int scope;
+ while (iterator.hasNext()) {
+ scope = iterator.next().intValue();
+ Bindings b = ctx.getBindings(scope);
+ if (b != null) {
+ Iterator<String> bIterator = b.keySet().iterator();
+ while (bIterator.hasNext()) {
+ list.add(bIterator.next());
+ }
+ }
+ }
+ }
+ for (Iterator names = parent.getNames(); names.hasNext();) {
+ list.add(names.next());
+ }
+ return Collections.unmodifiableList(list).iterator();
+ }
+ });
+ }
+
+ private void setGlobalVariables(GlobalVariables globals) {
+ runtime.setGlobalVariables(globals);
+ }
+
+ private synchronized Object evalNode(Node node, ScriptContext ctx)
+ throws ScriptException {
+ GlobalVariables oldGlobals = runtime.getGlobalVariables();
+ try {
+ setGlobalVariables(ctx);
+ return rubyToJava(runtime.eval(node));
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ } finally {
+ if (oldGlobals != null) {
+ //setGlobalVariables(oldGlobals);
+ }
+ }
+ }
+
+ private void init(String loadPath) {
+ runtime = Ruby.getDefaultInstance();
+ if (loadPath == null) {
+ loadPath = System.getProperty("java.class.path");
+ }
+ List list = Arrays.asList(loadPath.split(File.pathSeparator));
+ runtime.getLoadService().init(list);
+ runtime.getLoadService().require("java");
+ }
+
+ private Object invokeImpl(final Object obj, String method,
+ Object[] args, Class returnType)
+ throws ScriptException {
+ if (method == null) {
+ throw new NullPointerException("method name is null");
+ }
+
+ try {
+ IRubyObject rubyRecv = obj != null ?
+ JavaUtil.convertJavaToRuby(runtime, obj) : runtime.getTopSelf();
+
+ IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(runtime, args);
+
+ // Create Ruby proxies for any input arguments that are not primitives.
+ IRubyObject javaUtilities = runtime.getObject().getConstant("JavaUtilities");
+ for (int i = 0; i < rubyArgs.length; i++) {
+ IRubyObject tmp = rubyArgs[i];
+ if (tmp instanceof JavaObject) {
+ rubyArgs[i] = javaUtilities.callMethod(runtime.getCurrentContext(), "wrap", tmp);
+ }
+ }
+
+ IRubyObject result = rubyRecv.callMethod(runtime.getCurrentContext(), method, rubyArgs);
+ return rubyToJava(result, returnType);
+ } catch (Exception exp) {
+ throw new ScriptException(exp);
+ }
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..21c8ad9c32
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.implementation.script.ScriptModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java
new file mode 100644
index 0000000000..e050cd7083
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.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.implementation.script.itests;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public abstract class AbstractSCATestCase<T> extends TestCase {
+
+ protected SCADomain domain;
+ protected T service;
+
+ @SuppressWarnings("unchecked")
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance(getCompositeName());
+ service = (T) domain.getService(getServiceClass(), "ClientComponent");
+ }
+
+ abstract protected Class getServiceClass();
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ protected String getCompositeName() {
+ String className = this.getClass().getName();
+ return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..dedc8bce09
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ assertEquals("Hello petra", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..39161a447b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java
new file mode 100644
index 0000000000..e86119b72e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.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.implementation.script.itests.helloworld;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java
new file mode 100644
index 0000000000..9485f39faa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.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.implementation.script.itests.helloworld;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java
new file mode 100644
index 0000000000..56015b5f7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..2ccbd4d4b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..79c204c759
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.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.implementation.script.itests.helloworld;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
new file mode 100644
index 0000000000..8d9e7b119f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.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.implementation.script.itests.properties;
+
+import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
+
+public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
+
+ public void testCalculator() throws Exception {
+ // assertEquals("Hello petra from Tuscany", service.sayHello("petra"));
+ }
+
+ @Override
+ protected Class<HelloWorld> getServiceClass() {
+ return HelloWorld.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java
new file mode 100644
index 0000000000..996978e196
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java
new file mode 100644
index 0000000000..73fcd77b44
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.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.implementation.script.itests.properties;
+
+public interface HelloWorld {
+
+ public String sayHello(String s);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java
new file mode 100644
index 0000000000..bd18153be8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.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.implementation.script.itests.properties;
+
+import org.osoa.sca.annotations.Reference;
+
+public class HelloWorldProxy implements HelloWorld {
+
+ @Reference
+ public HelloWorld delegate;
+
+ public String sayHello(String s) {
+ return delegate.sayHello(s);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java
new file mode 100644
index 0000000000..8220fcade8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.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.implementation.script.itests.properties;
+
+public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java
new file mode 100644
index 0000000000..abd3ff311d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java
new file mode 100644
index 0000000000..c2f1ce811d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.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.implementation.script.itests.properties;
+
+
+public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java
new file mode 100644
index 0000000000..3f72c6cf45
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class GroovyReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java
new file mode 100644
index 0000000000..454843ea6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld;
+
+public class HelloWorldTarget implements HelloWorld {
+
+ public String sayHello(String s) {
+ return "Hello " + s;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java
new file mode 100644
index 0000000000..3c8b77e39f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JRubyReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java
new file mode 100644
index 0000000000..9caf7a715f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JavaScriptReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java
new file mode 100644
index 0000000000..26c970a56b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.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.implementation.script.itests.references;
+
+import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
+
+public class JythonReferenceTestCase extends AbstractHelloWorldTestCase {
+ // super class does it all getting composite based on this class name
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..e1cf7746d8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite
@@ -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"
+ name="GroovyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..a50fa8d01c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite
@@ -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"
+ name="JRubyHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..2ae739789e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
@@ -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"
+ name="JavaScriptHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite
new file mode 100644
index 0000000000..9b86752993
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite
@@ -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"
+ name="JythonHelloWorld">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType
new file mode 100644
index 0000000000..bb0ddd002f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy
new file mode 100644
index 0000000000..9f89bd373e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def sayHello(s) {
+ return "Hello " + s
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js
new file mode 100644
index 0000000000..eac2ab283f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js
@@ -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.
+ */
+
+function sayHello(s) {
+
+ return "Hello " + s;
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
new file mode 100644
index 0000000000..f5dd0f8fcf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return 'Hello ' + s \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb
new file mode 100644
index 0000000000..cd2d3bcaea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb
@@ -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.
+#
+
+def sayHello(s)
+ return "Hello " + s
+end \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite
new file mode 100644
index 0000000000..08277e117c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite
@@ -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"
+ name="GroovyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite
new file mode 100644
index 0000000000..9eeffe09b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite
@@ -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"
+ name="JRubyProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent" />
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite
new file mode 100644
index 0000000000..1a733f9ae8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite
@@ -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"
+ name="JavaScriptProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite
new file mode 100644
index 0000000000..b03aa0ae14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite
@@ -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"
+ name="JythonProperties">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
+ <reference name="delegate" target="HelloWorldComponent"></reference>
+ </component>
+
+ <component name="HelloWorldComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
new file mode 100644
index 0000000000..06f261015e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
@@ -0,0 +1,32 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <property name="greeter" type="xsd:string">Tuscany</property>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy
new file mode 100644
index 0000000000..a7eb446d37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def sayHello(s) {
+ return "Hello " + s + " from " + greeter
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js
new file mode 100644
index 0000000000..64df3ebbef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js
@@ -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.
+ */
+
+function sayHello(s) {
+
+ return "Hello " + s + " from " + greeter;
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
new file mode 100644
index 0000000000..868cfa9eeb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return 'Hello ' + s + ' from ' + greeter \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb
new file mode 100644
index 0000000000..2844f8b8d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb
@@ -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.
+#
+
+def sayHello(s)
+ return "Hello " + s + " from " + $greeter
+end \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
new file mode 100644
index 0000000000..cbcd11549d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
@@ -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="GroovyReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
new file mode 100644
index 0000000000..9b8bd45837
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
@@ -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="JRubyReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.rb"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
new file mode 100644
index 0000000000..a74cdfb9e3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
@@ -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="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.js"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
new file mode 100644
index 0000000000..4d6f9ab27c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
@@ -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="JavaScriptReference">
+
+ <component name="ClientComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+ <reference name="delegate" target="ReferenceComponent"></reference>
+ </component>
+
+ <component name="ReferenceComponent">
+ <implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.py"/>
+ <reference name="ref" target="TargetComponent" />
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType
new file mode 100644
index 0000000000..3edd075126
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType
@@ -0,0 +1,31 @@
+<?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="HelloWorldService">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </service>
+
+ <reference name="ref">
+ <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
new file mode 100644
index 0000000000..5d2216d583
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def sayHello(s) {
+ return ref.sayHello(s)
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js
new file mode 100644
index 0000000000..ad0a932d26
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 ref.sayHello(s);
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
new file mode 100644
index 0000000000..aee8bf991d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def sayHello(s):
+ return ref.sayHello(s)
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb
new file mode 100644
index 0000000000..87f0f56082
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb
@@ -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.
+#
+
+def sayHello(s)
+ return $ref.sayHello(s)
+end \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/pom.xml
new file mode 100644
index 0000000000..f3ac87041e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java-runtime</artifactId>
+ <name>Apache Tuscany Java Interface Runtime Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java
new file mode 100644
index 0000000000..4a7642f23a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.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.interfacedef.java.module;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceRuntimeModuleActivator implements ModuleActivator {
+
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospectorExtensionPoint visitors;
+
+ public JavaInterfaceRuntimeModuleActivator() {
+ javaFactory = new DefaultJavaInterfaceFactory();
+ visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ }
+
+ public Object[] getExtensionPoints() {
+ return new Object[]{ visitors };
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Register <interface.java> processor
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ JavaInterfaceProcessor javaInterfaceProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ processors.addArtifactProcessor(javaInterfaceProcessor);
+
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..bfa96800bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.interfacedef.java.module.JavaInterfaceRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/.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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/pom.xml
new file mode 100644
index 0000000000..29fc36d36e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/pom.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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <name>Apache Tuscany SCA XML Java Interface Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/DefaultJavaInterfaceIntrospectorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/DefaultJavaInterfaceIntrospectorExtensionPoint.java
new file mode 100644
index 0000000000..fc35ef76b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/DefaultJavaInterfaceIntrospectorExtensionPoint.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.interfacedef.java.introspect;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Default implementation of an extension point for Java interface visitors.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultJavaInterfaceIntrospectorExtensionPoint implements JavaInterfaceIntrospectorExtensionPoint {
+
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+
+ public DefaultJavaInterfaceIntrospectorExtensionPoint() {
+ }
+
+ public void addInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.add(extension);
+ }
+
+ public void removeInterfaceVisitor(JavaInterfaceVisitor extension) {
+ visitors.remove(extension);
+ }
+
+ public List<JavaInterfaceVisitor> getInterfaceVisitors() {
+ return visitors;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java
new file mode 100644
index 0000000000..9ceb194fd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.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.interfacedef.java.introspect;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Default implementation of a Java interface introspector.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleJavaInterfaceIntrospector implements JavaInterfaceIntrospector {
+ public static final String IDL_INPUT = "idl:input";
+
+ private static final String UNKNOWN_DATABINDING = null;
+
+ private JavaInterfaceFactory javaFactory;
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+
+ public ExtensibleJavaInterfaceIntrospector(JavaInterfaceFactory javaFactory, JavaInterfaceIntrospectorExtensionPoint visitors) {
+ this.javaFactory = javaFactory;
+ this.visitors = visitors.getInterfaceVisitors();
+ }
+
+ public JavaInterface introspect(Class<?> type) throws InvalidInterfaceException {
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setJavaClass(type);
+
+ boolean remotable = type.isAnnotationPresent(Remotable.class);
+ javaInterface.setRemotable(remotable);
+
+ boolean conversational = type.isAnnotationPresent(Conversational.class);
+ javaInterface.setConversational(conversational);
+
+ Class<?> callbackClass = null;
+ org.osoa.sca.annotations.Callback callback = type.getAnnotation(org.osoa.sca.annotations.Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ callbackClass = callback.value();
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidCallbackException("No callback interface specified on annotation");
+ }
+ javaInterface.setCallbackClass(callbackClass);
+
+ javaInterface.getOperations().addAll(getOperations(type, remotable, conversational));
+
+ for (JavaInterfaceVisitor extension : visitors) {
+ extension.visitInterface(javaInterface);
+ }
+ return javaInterface;
+ }
+
+ private <T> List<Operation> getOperations(Class<T> type, boolean remotable, boolean conversational)
+ throws InvalidInterfaceException {
+ Method[] methods = type.getMethods();
+ List<Operation> operations = new ArrayList<Operation>(methods.length);
+ Set<String> names = remotable? new HashSet<String>() : null;
+ for (Method method : methods) {
+ String name = method.getName();
+ if (remotable && names.contains(name)) {
+ throw new OverloadedOperationException(method);
+ }
+ if(remotable) {
+ names.add(name);
+ }
+
+ Class returnType = method.getReturnType();
+ Class[] paramTypes = method.getParameterTypes();
+ Class[] faultTypes = method.getExceptionTypes();
+ boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
+ ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
+ if (method.isAnnotationPresent(EndsConversation.class)) {
+ if (!conversational) {
+ throw new InvalidOperationException(
+ "Method is marked as end conversation but contract is not conversational",
+ method);
+ }
+ conversationSequence = ConversationSequence.CONVERSATION_END;
+ } else if (conversational) {
+ conversationSequence = ConversationSequence.CONVERSATION_CONTINUE;
+ }
+
+ // Set outputType to null for void
+ DataType<Class> returnDataType = returnType == void.class ? null
+ : new DataTypeImpl<Class>(UNKNOWN_DATABINDING,
+ returnType, returnType);
+ List<DataType> paramDataTypes = new ArrayList<DataType>(paramTypes.length);
+ for (Class paramType : paramTypes) {
+ paramDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, paramType, paramType));
+ }
+ List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
+ for (Class faultType : faultTypes) {
+ // Only add checked exceptions
+ if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))) {
+ faultDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, faultType, faultType));
+ }
+ }
+
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class,
+ paramDataTypes);
+ Operation operation = new OperationImpl(name);
+ operation.setInputType(inputType);
+ operation.setOutputType(returnDataType);
+ operation.setFaultTypes(faultDataTypes);
+ operation.setConversationSequence(conversationSequence);
+ operation.setNonBlocking(nonBlocking);
+ operations.add(operation);
+ }
+ return operations;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java
new file mode 100644
index 0000000000..eb107aff7c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.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.interfacedef.java.introspect;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ * Processor for creating JavaServiceContract definitions from Java Classes.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceIntrospector {
+
+ /**
+ * Introspect a Java interface and return a JavaInterface model.
+ *
+ * @param type the interface to inspect
+ * @return a JavaInterface corresponding to the Java interface
+ */
+ JavaInterface introspect(Class<?> type) throws InvalidInterfaceException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospectorExtensionPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospectorExtensionPoint.java
new file mode 100644
index 0000000000..1a68e006a7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospectorExtensionPoint.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.interfacedef.java.introspect;
+
+import java.util.List;
+
+/**
+ * An extension point for Java interface visitors.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceIntrospectorExtensionPoint {
+
+ /**
+ * Registers the given visitor.
+ *
+ * @param visitor
+ */
+ void addInterfaceVisitor(JavaInterfaceVisitor visitor);
+
+ /**
+ * Deregisters the given visitor.
+ *
+ * @param visitor
+ */
+ void removeInterfaceVisitor(JavaInterfaceVisitor visitor);
+
+ /**
+ * Returns a list of interface visitors.
+ *
+ * @return
+ */
+ List<JavaInterfaceVisitor> getInterfaceVisitors();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java
new file mode 100644
index 0000000000..3bc03a528e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.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.interfacedef.java.introspect;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ * Implementations introspect metadata on a Java interface, populating the
+ * corresponding {@link JavaInterface}
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceVisitor {
+
+ /**
+ * Visit a java interface
+ * @param javaInterface
+ * @throws InvalidInterfaceException
+ */
+ void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java
new file mode 100644
index 0000000000..852f3dc3b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.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.sca.interfacedef.java.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface JavaConstants {
+
+ String INTERFACE_JAVA = "interface.java";
+ QName INTERFACE_JAVA_QNAME = new QName(Constants.SCA10_NS, "interface.java");
+ String INTERFACE = "interface";
+ String CALLBACK_INTERFACE = "callbackInterface";
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
new file mode 100644
index 0000000000..cc27d88ba8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.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.interfacedef.java.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_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.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+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.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+
+public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants {
+
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector introspector;
+
+ public JavaInterfaceProcessor(JavaInterfaceFactory javaFactory, JavaInterfaceIntrospector introspector) {
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ private JavaInterface createJavaInterface(String interfaceName) {
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setUnresolved(true);
+ javaInterface.setName(interfaceName);
+ return javaInterface;
+ }
+
+ public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException {
+ try {
+ // Read an <interface.java>
+ JavaInterfaceContract javaInterfaceContract = javaFactory.createJavaInterfaceContract();
+ String interfaceName = reader.getAttributeValue(null, INTERFACE);
+ if (interfaceName != null) {
+ JavaInterface javaInterface = createJavaInterface(interfaceName);
+ javaInterfaceContract.setInterface(javaInterface);
+ }
+
+ String callbackInterfaceName = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+ if (callbackInterfaceName != null) {
+ JavaInterface javaCallbackInterface = createJavaInterface(callbackInterfaceName);
+ javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return javaInterfaceContract;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write an <interface.java>
+ writer.writeStartElement(Constants.SCA10_NS, INTERFACE_JAVA);
+ JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
+ if (javaInterface != null && javaInterface.getName() != null) {
+ writer.writeAttribute(INTERFACE, javaInterface.getName());
+ }
+ JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
+ if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) {
+ writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName());
+ }
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ private JavaInterface resolveJavaInterface(JavaInterface javaInterface, ModelResolver resolver) throws ContributionResolveException {
+
+ if (javaInterface != null && javaInterface.isUnresolved()) {
+
+ // Resolve the Java interface
+ javaInterface = resolver.resolveModel(JavaInterface.class, javaInterface);
+ if (javaInterface.isUnresolved()) {
+
+ // If the Java interface has never been resolved yet, do it now
+ ClassReference classReference = new ClassReference(javaInterface.getName());
+ classReference = resolver.resolveModel(ClassReference.class, classReference);
+ Class javaClass = classReference.getJavaClass();
+ if (javaClass == null) {
+ throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
+ }
+ try {
+
+ // Introspect the Java interface and populate the interface and
+ // operations
+ javaInterface = introspector.introspect(javaClass);
+
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+
+ // Cache the resolved interface
+ javaInterface.setUnresolved(false);
+ resolver.addModel(javaInterface);
+ }
+ }
+ return javaInterface;
+ }
+
+ public void resolve(JavaInterfaceContract javaInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the interface and callback interface
+ JavaInterface javaInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getInterface(), resolver);
+ javaInterfaceContract.setInterface(javaInterface);
+
+ JavaInterface javaCallbackInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getCallbackInterface(), resolver);
+ javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
+ }
+
+ public QName getArtifactType() {
+ return INTERFACE_JAVA_QNAME;
+ }
+
+ public Class<JavaInterfaceContract> getModelType() {
+ return JavaInterfaceContract.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
new file mode 100644
index 0000000000..72a493c47c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.java.introspection.impl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ConversationalIntrospectionTestCase extends TestCase {
+ private JavaInterfaceFactory javaFactory;
+ private ExtensibleJavaInterfaceIntrospector introspector;
+
+ protected void setUp() throws Exception {
+ javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ }
+
+ private Operation getOperation(Interface i, String name) {
+ for (Operation op : i.getOperations()) {
+ if (op.getName().equals(name)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ public void testServiceContractConversationalInformationIntrospection() throws Exception {
+ Interface i = introspector.introspect(Foo.class);
+ assertNotNull(i);
+ assertTrue(i.isConversational());
+ ConversationSequence seq = getOperation(i, "operation").getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_CONTINUE, seq);
+ seq = getOperation(i, "endOperation").getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_END, seq);
+ }
+
+ public void testBadServiceContract() throws Exception {
+ try {
+ introspector.introspect(BadFoo.class);
+ fail();
+ } catch (InvalidOperationException e) {
+ // expected
+ }
+ }
+
+ public void testNonConversationalInformationIntrospection() throws Exception {
+ Interface i = introspector.introspect(NonConversationalFoo.class);
+ assertFalse(i.isConversational());
+ ConversationSequence seq = getOperation(i, "operation")
+ .getConversationSequence();
+ assertEquals(ConversationSequence.CONVERSATION_NONE, seq);
+ }
+
+ @Conversational
+ private interface Foo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface BadFoo {
+ void operation();
+
+ @EndsConversation
+ void endOperation();
+ }
+
+ private interface NonConversationalFoo {
+ void operation();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
new file mode 100644
index 0000000000..f804dfb48c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.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.sca.interfacedef.java.introspection.impl;
+
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expectLastCall;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.io.IOException;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
+ private ExtensibleJavaInterfaceIntrospector impl;
+ private DefaultJavaInterfaceIntrospectorExtensionPoint visitors;
+
+ @SuppressWarnings("unchecked")
+ public void testSimpleInterface() throws InvalidInterfaceException {
+ JavaInterface intf = (JavaInterface)impl.introspect(Simple.class);
+
+ assertEquals(Simple.class, intf.getJavaClass());
+ List<Operation> operations = intf.getOperations();
+ assertEquals(1, operations.size());
+ Operation baseInt = operations.get(0);
+ assertEquals("baseInt", baseInt.getName());
+
+ DataType<Type> returnType = baseInt.getOutputType();
+ assertEquals(Integer.TYPE, returnType.getPhysical());
+ assertEquals(Integer.TYPE, returnType.getLogical());
+
+ List<DataType> parameterTypes = baseInt.getInputType().getLogical();
+ assertEquals(1, parameterTypes.size());
+ DataType<Type> arg0 = parameterTypes.get(0);
+ assertEquals(Integer.TYPE, arg0.getPhysical());
+ assertEquals(Integer.TYPE, arg0.getLogical());
+
+ List<DataType> faultTypes = baseInt.getFaultTypes();
+ assertEquals(1, faultTypes.size());
+ DataType<Type> fault0 = faultTypes.get(0);
+ assertEquals(IOException.class, fault0.getPhysical());
+ assertEquals(IOException.class, fault0.getLogical());
+ }
+
+ public void testUnregister() throws Exception {
+ JavaInterfaceVisitor extension = createMock(JavaInterfaceVisitor.class);
+ extension.visitInterface(EasyMock.isA(JavaInterface.class));
+ expectLastCall().once();
+ replay(extension);
+ visitors.addInterfaceVisitor(extension);
+ impl.introspect(Base.class);
+ visitors.removeInterfaceVisitor(extension);
+ impl.introspect(Base.class);
+ verify(extension);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ impl = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+
+ }
+
+ private static interface Base {
+ int baseInt(int param) throws IllegalArgumentException, IOException;
+ }
+
+ private static interface Simple extends Base {
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
new file mode 100644
index 0000000000..b1756224ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.java.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private JavaInterfaceFactory javaFactory;
+
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ javaFactory = new DefaultJavaInterfaceFactory();
+
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeReader.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+ assertNotNull(constrainingType);
+
+ //new PrintUtil(System.out).print(constrainingType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
new file mode 100644
index 0000000000..464812da9a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.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.interfacedef.java.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing Java interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+ private JavaInterfaceFactory javaFactory;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+ javaFactory = new DefaultJavaInterfaceFactory();
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ staxProcessors.addArtifactProcessor(javaProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ assertNotNull(constrainingType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite
new file mode 100644
index 0000000000..3de6410596
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite
@@ -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:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..dca38c9224
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,34 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService" />
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..23ebf576e5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType
@@ -0,0 +1,31 @@
+<?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">
+
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java interface="calculator.DivideService" />
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/.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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/pom.xml
new file mode 100644
index 0000000000..1c9c949680
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-java</artifactId>
+ <name>Apache Tuscany Java Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java
new file mode 100644
index 0000000000..d639c112b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.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.interfacedef.java;
+
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
+
+/**
+ * A factory for the Java interface model.
+ */
+public class DefaultJavaInterfaceFactory extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ public DefaultJavaInterfaceFactory() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
new file mode 100644
index 0000000000..700b3192f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.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.interfacedef.java;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterface extends Interface {
+
+ /**
+ * Returns the name of the Java interface class.
+ *
+ * @return the name of the Java interface class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java interface class.
+ *
+ * @param className the name of the Java interface class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java interface class.
+ *
+ * @return the Java interface class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java interface class.
+ *
+ * @param javaClass the Java interface class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+ /**
+ * Returns the callback class specified in an @Callback annotation.
+ *
+ * @return the callback class specified in an @Callback annotation
+ */
+ Class<?> getCallbackClass();
+
+ /**
+ * Sets the callback class specified in an @Callback annotation.
+ *
+ * @param callbackClass the callback class specified in an @Callback annotation
+ */
+ void setCallbackClass(Class<?> callbackClass);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java
new file mode 100644
index 0000000000..e3a84c63f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.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.sca.interfacedef.java;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents a Java interface contract.
+ * JavaInterfaceContract
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceContract extends InterfaceContract {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java
new file mode 100644
index 0000000000..671a0b8fe2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.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.sca.interfacedef.java;
+
+/**
+ * Factory for the Java interface model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterfaceFactory {
+
+ /**
+ * Creates a new Java interface.
+ *
+ * @return
+ */
+ JavaInterface createJavaInterface();
+
+ /**
+ * Creates a new Java interface contract.
+ *
+ * @return
+ */
+ JavaInterfaceContract createJavaInterfaceContract();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java
new file mode 100644
index 0000000000..dadae792a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.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.interfacedef.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+
+/**
+ * Represents a Java interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceContractImpl extends InterfaceContractImpl implements JavaInterfaceContract {
+
+ protected JavaInterfaceContractImpl() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
new file mode 100644
index 0000000000..4b7628dfb5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.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.interfacedef.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * A factory for the Java model.
+ */
+public abstract class JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ public JavaInterface createJavaInterface() {
+ return new JavaInterfaceImpl();
+ }
+
+ public JavaInterfaceContract createJavaInterfaceContract() {
+ return new JavaInterfaceContractImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
new file mode 100644
index 0000000000..513f95f841
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.interfacedef.java.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
+
+ private String className;
+ private Class<?> javaClass;
+ private Class<?> callbackClass;
+
+ protected JavaInterfaceImpl() {
+ }
+
+ public String getName() {
+ if (isUnresolved()) {
+ return className;
+ } else if (javaClass != null) {
+ return javaClass.getName();
+ } else {
+ return null;
+ }
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+ public Class<?> getCallbackClass() {
+ return callbackClass;
+ }
+
+ public void setCallbackClass(Class<?> callbackClass) {
+ this.callbackClass = callbackClass;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof JavaInterface) {
+ if (getName() != null) {
+ return getName().equals(((JavaInterface)obj).getName());
+ } else {
+ return ((JavaInterface)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
new file mode 100644
index 0000000000..78476af077
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.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.sca.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Contains methods for mapping between an operation in a
+ * {@link org.apache.tuscany.spi.model.ServiceContract} and a method defined by
+ * a Java interface
+ *
+ * @version $Rev$ $Date$
+ */
+public final class JavaInterfaceUtil {
+
+ private JavaInterfaceUtil() {
+ }
+
+ /**
+ * Return the method on the implementation class that matches the operation.
+ *
+ * @param implClass the implementation class or interface
+ * @param operation the operation to match
+ * @return the method described by the operation
+ * @throws NoSuchMethodException if no such method exists
+ * @Deprecated
+ */
+ public static Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
+ String name = operation.getName();
+ Interface interface1 = operation.getInterface();
+ if(interface1!=null && interface1.isRemotable()) {
+ for(Method m: implClass.getMethods()) {
+ if(m.getName().equals(name)) {
+ return m;
+ }
+ }
+ throw new NoSuchMethodException(name);
+ }
+ Class<?>[] paramTypes = getPhysicalTypes(operation);
+ return implClass.getMethod(name, paramTypes);
+ }
+
+ /**
+ * @Deprecated
+ */
+ private static Class<?>[] getPhysicalTypes(Operation operation) {
+ DataType<List<DataType>> inputType = operation.getInputType();
+ if(inputType==null) {
+ return new Class<?>[] {};
+ }
+ List<DataType> types = inputType.getLogical();
+ Class<?>[] javaTypes = new Class<?>[types.size()];
+ for (int i = 0; i < javaTypes.length; i++) {
+ Type physical = types.get(i).getPhysical();
+ if (physical instanceof Class<?>) {
+ javaTypes[i] = (Class<?>) physical;
+ } else {
+ throw new UnsupportedOperationException();
+ }
+ }
+ return javaTypes;
+ }
+
+ /**
+ * Searches a collection of operations for a match against the given method
+ *
+ * @param method the method to match
+ * @param operations the operations to match against
+ * @return a matching operation or null
+ * @Deprecated
+ */
+ public static Operation findOperation(Method method, Collection<Operation> operations) {
+ for (Operation operation : operations) {
+ if (match(operation, method)) {
+ return operation;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Determines if the given operation matches the given method
+ *
+ * @return true if the operation matches, false if does not
+ */
+ private static boolean match(Operation operation, Method method) {
+ Class<?>[] params = method.getParameterTypes();
+ DataType<List<DataType>> inputType = operation.getInputType();
+ List<DataType> types = inputType.getLogical();
+ boolean found = true;
+ if (types.size() == params.length && method.getName().equals(operation.getName())) {
+ for (int i = 0; i < params.length; i++) {
+ Class<?> clazz = params[i];
+ if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
+ found = false;
+ }
+ }
+ } else {
+ found = false;
+ }
+ return found;
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
new file mode 100644
index 0000000000..936e6f8cfb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.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.sca.interfacedef.java.impl;
+
+import static org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil.findOperation;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceUtilTestCase extends TestCase {
+ private List<Operation> operations;
+
+ public void testNoParamsFindOperation() throws Exception {
+ Method method = Foo.class.getMethod("foo");
+ Operation ret = findOperation(method, operations);
+ assertEquals("foo", ret.getName());
+ assertEquals(0, method.getParameterTypes().length);
+ }
+
+ public void testParamsFindOperation() throws Exception {
+ Method method = Foo.class.getMethod("foo", String.class);
+ Operation ret = findOperation(method, operations);
+ assertEquals("foo", ret.getName());
+ assertEquals(String.class, method.getParameterTypes()[0]);
+ }
+
+ public void testPrimitiveParamFindOperation() throws NoSuchMethodException {
+ Method method = Foo.class.getMethod("foo", Integer.TYPE);
+ Operation operation = findOperation(method, operations);
+ assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Operation operation = new OperationImpl("foo");
+ List<DataType> types = new ArrayList<DataType>();
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation.setInputType(inputType);
+
+ operations = new ArrayList<Operation>();
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ DataType type = new DataTypeImpl<Class>(String.class, Object.class);
+ types.add(type);
+ operation = new OperationImpl("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(String.class, Object.class);
+ DataType type2 = new DataTypeImpl<Class>(String.class, Object.class);
+ types.add(type);
+ types.add(type2);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = new OperationImpl("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(Integer.class, Object.class);
+ types.add(type);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = new OperationImpl("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ types = new ArrayList<DataType>();
+ type = new DataTypeImpl<Class>(Integer.TYPE, Object.class);
+ types.add(type);
+ inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
+ operation = new OperationImpl("foo");
+ operation.setInputType(inputType);
+ operations.add(operation);
+
+ }
+
+ private interface Foo {
+ void foo();
+
+ void foo(String foo);
+
+ void foo(int b);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/pom.xml
new file mode 100644
index 0000000000..34090e0318
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl-runtime</artifactId>
+ <name>Apache Tuscany WSDL Interface Runtime Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/module/WSDLInterfaceRuntimeModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/module/WSDLInterfaceRuntimeModuleActivator.java
new file mode 100644
index 0000000000..6885ef05a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/module/WSDLInterfaceRuntimeModuleActivator.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 org.apache.tuscany.sca.interfacedef.wsdl.module;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.DefaultWSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLInterfaceProcessor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class WSDLInterfaceRuntimeModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ WSDLFactory wsdlFactory = new DefaultWSDLFactory();
+ WSDLInterfaceIntrospector interfaceIntrospector = new DefaultWSDLInterfaceIntrospector(wsdlFactory);
+
+ // Register <interface.wsdl> processor
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ processors.addArtifactProcessor(new WSDLInterfaceProcessor(wsdlFactory, interfaceIntrospector));
+
+ // Register .wsdl document processor
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ documentProcessors.addArtifactProcessor(new WSDLDocumentProcessor(wsdlFactory, null));
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..90bbc8954d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ModuleActivator
+org.apache.tuscany.sca.interfacedef.wsdl.module.WSDLInterfaceRuntimeModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/.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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/pom.xml
new file mode 100644
index 0000000000..75f80d53b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl-xml</artifactId>
+ <name>Apache Tuscany SCA XML WSDL Interface Extension</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-contribution</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospector.java
new file mode 100644
index 0000000000..5d77d458ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospector.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.sca.interfacedef.wsdl.introspect;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+/**
+ * Introspector for creating WSDLInterface definitions from WSDL PortTypes.
+ */
+public class DefaultWSDLInterfaceIntrospector implements WSDLInterfaceIntrospector {
+
+ private WSDLFactory wsdlFactory;
+
+ public DefaultWSDLInterfaceIntrospector(WSDLFactory wsdlFactory) {
+ super();
+ this.wsdlFactory = wsdlFactory;
+ }
+
+ // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS spec?
+ protected List<Operation> introspectOperations(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException {
+ List<Operation> operations = new ArrayList<Operation>();
+ for (Object o : portType.getOperations()) {
+ javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o;
+ WSDLOperation op = new WSDLOperation(wsdlFactory, wsdlOp, inlineSchemas, null, resolver);
+ operations.add(op.getOperation());
+ }
+ return operations;
+ }
+
+ public WSDLInterface introspect(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException {
+ WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+ wsdlInterface.setPortType(portType);
+ wsdlInterface.getOperations().addAll(introspectOperations(portType, inlineSchemas, resolver));
+ // FIXME: set to Non-conversational for now
+ wsdlInterface.setConversational(false);
+ return wsdlInterface;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/InvalidWSDLException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/InvalidWSDLException.java
new file mode 100644
index 0000000000..20780df23e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/InvalidWSDLException.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.interfacedef.wsdl.introspect;
+
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+
+/**
+ * An exception to indicate the WSDL definition is invalid
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidWSDLException extends InvalidInterfaceException {
+ private static final long serialVersionUID = 3742887584293256519L;
+
+ public InvalidWSDLException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospector.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospector.java
new file mode 100644
index 0000000000..075c41b3b5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospector.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.interfacedef.wsdl.introspect;
+
+import javax.wsdl.PortType;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+/**
+ * Introspector for creating WSDLInterface definitions from WSDL PortTypes.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLInterfaceIntrospector {
+
+ /**
+ * Introspect a WSDL portType and return a WSDL interface definition.
+ *
+ * @param type the portType to inspect
+ * @return a WSDLInterface corresponding to the WSDL portType
+ */
+ WSDLInterface introspect(PortType portType, XmlSchemaCollection inlineSchemas, ModelResolver resolver) throws InvalidInterfaceException;
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperation.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperation.java
new file mode 100644
index 0000000000..70f56ff8a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperation.java
@@ -0,0 +1,556 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.introspect;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.FaultException;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaParticle;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * Metadata for a WSDL operation
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLOperation {
+ private WSDLFactory wsdlFactory;
+ protected ModelResolver resolver;
+ protected XmlSchemaCollection inlineSchemas;
+ protected javax.wsdl.Operation operation;
+ protected Operation operationModel;
+ protected DataType<List<DataType>> inputType;
+ protected DataType outputType;
+ protected List<DataType> faultTypes;
+ private String dataBinding;
+
+ /**
+ * @param operation The WSDL4J operation
+ * @param dataBinding The default databinding
+ * @param schemaRegistry The XML Schema registry
+ */
+ public WSDLOperation(
+ WSDLFactory wsdlFactory,
+ javax.wsdl.Operation operation,
+ XmlSchemaCollection inlineSchemas,
+ String dataBinding,
+ ModelResolver resolver) {
+ super();
+ this.wsdlFactory = wsdlFactory;
+ this.operation = operation;
+ this.inlineSchemas = inlineSchemas;
+ this.resolver = resolver;
+ this.dataBinding = dataBinding;
+ this.wrapper = new Wrapper();
+ }
+
+ private Wrapper wrapper;
+
+ private Boolean wrapperStyle;
+
+ /**
+ * Test if the operation qualifies wrapper style as defined by the JAX-WS
+ * 2.0 spec
+ *
+ * @return true if the operation qualifies wrapper style, otherwise false
+ */
+ public boolean isWrapperStyle() throws InvalidWSDLException {
+ if (wrapperStyle == null) {
+ wrapperStyle =
+ wrapper.getInputChildElements() != null && (operation.getOutput() == null || wrapper
+ .getOutputChildElements() != null);
+ }
+ return wrapperStyle;
+ }
+
+ public Wrapper getWrapper() throws InvalidInterfaceException {
+ if (!isWrapperStyle()) {
+ throw new IllegalStateException("The operation is not wrapper style.");
+ } else {
+ return wrapper;
+ }
+ }
+
+ /**
+ * @return
+ * @throws InvalidServiceContractException
+ */
+ public DataType<List<DataType>> getInputType() throws InvalidWSDLException {
+ if (inputType == null) {
+ Input input = operation.getInput();
+ Message message = (input == null) ? null : input.getMessage();
+ inputType = getMessageType(message);
+ inputType.setDataBinding("idl:input");
+ }
+ return inputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ @SuppressWarnings("unchecked")
+ public DataType<XMLType> getOutputType() throws InvalidWSDLException {
+ if (outputType == null) {
+ Output output = operation.getOutput();
+ Message outputMsg = (output == null) ? null : output.getMessage();
+
+ List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null);
+ if (outputParts != null && outputParts.size() > 0) {
+ if (outputParts.size() > 1) {
+ // We don't support output with multiple parts
+ throw new InvalidWSDLException("Multi-part output is not supported");
+ }
+ Part part = (Part)outputParts.get(0);
+ outputType = new WSDLPart(part, Object.class).getDataType();
+ // outputType.setMetadata(WSDLOperation.class.getName(), this);
+ }
+ }
+ return outputType;
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public List<DataType> getFaultTypes() throws InvalidWSDLException {
+ if (faultTypes == null) {
+ Collection faults = operation.getFaults().values();
+ faultTypes = new ArrayList<DataType>();
+ for (Object f : faults) {
+ Fault fault = (Fault)f;
+ Message faultMsg = fault.getMessage();
+ List faultParts = faultMsg.getOrderedParts(null);
+ if (faultParts.size() != 1) {
+ throw new InvalidWSDLException("The fault message MUST have a single part");
+ }
+ Part part = (Part)faultParts.get(0);
+ WSDLPart wsdlPart = new WSDLPart(part, FaultException.class);
+ faultTypes.add(wsdlPart.getDataType());
+ }
+ }
+ return faultTypes;
+ }
+
+ private DataType<List<DataType>> getMessageType(Message message) throws InvalidWSDLException {
+ List<DataType> partTypes = new ArrayList<DataType>();
+ if (message != null) {
+ Collection parts = message.getOrderedParts(null);
+ for (Object p : parts) {
+ WSDLPart part = new WSDLPart((Part)p, Object.class);
+ DataType<XMLType> partType = part.getDataType();
+ partTypes.add(partType);
+ }
+ }
+ return new DataTypeImpl<List<DataType>>(dataBinding, Object[].class, partTypes);
+ }
+
+ /**
+ * @return
+ * @throws NotSupportedWSDLException
+ */
+ public Operation getOperation() throws InvalidInterfaceException {
+ if (operationModel == null) {
+ boolean oneway = (operation.getOutput() == null);
+ operationModel = new OperationImpl();
+ operationModel.setName(operation.getName());
+ operationModel.setFaultTypes(getFaultTypes());
+ operationModel.setNonBlocking(oneway);
+ operationModel.setConversationSequence(ConversationSequence.CONVERSATION_NONE);
+ operationModel.setInputType(getInputType());
+ operationModel.setOutputType(getOutputType());
+
+ operationModel.setWrapperStyle(isWrapperStyle());
+ if (isWrapperStyle()) {
+ WrapperInfo wrapperInfo = getWrapper().getWrapperInfo();
+ operationModel.setWrapper(wrapperInfo);
+ }
+ }
+ return operationModel;
+ }
+
+ private XmlSchemaElement getElement(QName elementName) {
+ XmlSchemaElement element = inlineSchemas.getElementByQName(elementName);
+ if (element == null) {
+ XSDefinition definition = wsdlFactory.createXSDefinition();
+ definition.setUnresolved(true);
+ definition.setNamespace(elementName.getNamespaceURI());
+ definition = resolver.resolveModel(XSDefinition.class, definition);
+ if (definition.getSchema() != null) {
+ element = definition.getSchema().getElementByName(elementName);
+ }
+ }
+ return element;
+ }
+
+ private XmlSchemaType getType(QName typeName) {
+ XmlSchemaType type = inlineSchemas.getTypeByQName(typeName);
+ if (type == null) {
+ XSDefinition definition = wsdlFactory.createXSDefinition();
+ definition.setNamespace(typeName.getNamespaceURI());
+ definition.setUnresolved(true);
+ definition = resolver.resolveModel(XSDefinition.class, definition);
+ if (definition.getSchema() != null) {
+ type = definition.getSchema().getTypeByName(typeName);
+ }
+ }
+ return type;
+ }
+
+ /**
+ * Metadata for a WSDL part
+ */
+ public class WSDLPart {
+ private Part part;
+
+ private XmlSchemaElement element;
+
+ private DataType<XMLType> dataType;
+
+ public WSDLPart(Part part, Class javaType) throws InvalidWSDLException {
+ this.part = part;
+ QName elementName = part.getElementName();
+ if (elementName != null) {
+ element = WSDLOperation.this.getElement(elementName);
+ if (element == null) {
+ throw new InvalidWSDLException("Element cannot be resolved: " + elementName.toString());
+ }
+ } else {
+ // Create an faked XSD element to host the metadata
+ element = new XmlSchemaElement();
+ element.setName(part.getName());
+ element.setQName(new QName(null, part.getName()));
+ QName typeName = part.getTypeName();
+ if (typeName != null) {
+ XmlSchemaType type = WSDLOperation.this.getType(typeName);
+ if (type == null) {
+ throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString());
+ }
+ element.setSchemaType(type);
+ element.setSchemaTypeName(type.getQName());
+ }
+ }
+ dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, new XMLType(getElementInfo(element)));
+ // dataType.setMetadata(WSDLPart.class.getName(), this);
+ // dataType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ }
+
+ /**
+ * @return the element
+ */
+ public XmlSchemaElement getElement() {
+ return element;
+ }
+
+ /**
+ * @return the part
+ */
+ public Part getPart() {
+ return part;
+ }
+
+ /**
+ * @return the dataType
+ */
+ public DataType<XMLType> getDataType() {
+ return dataType;
+ }
+ }
+
+ /**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for
+ * XML-Based Web Services (JAX-WS) 2.0 specification, section 2.3.1.2
+ * Wrapper Style. <p/> A WSDL operation qualifies for wrapper style mapping
+ * only if the following criteria are met:
+ * <ul>
+ * <li>(i) The operation�s input and output messages (if present) each
+ * contain only a single part
+ * <li>(ii) The input message part refers to a global element declaration
+ * whose localname is equal to the operation name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(iv) The elements referred to by the input and output message parts
+ * (henceforth referred to as wrapper elements) are both complex types
+ * defined using the xsd:sequence compositor
+ * <li>(v) The wrapper elements only contain child elements, they must not
+ * contain other structures such as wildcards (element or attribute),
+ * xsd:choice, substitution groups (element references are not permitted) or
+ * attributes; furthermore, they must not be nillable.
+ * </ul>
+ */
+ public class Wrapper {
+ private XmlSchemaElement inputWrapperElement;
+
+ private XmlSchemaElement outputWrapperElement;
+
+ private List<XmlSchemaElement> inputElements;
+
+ private List<XmlSchemaElement> outputElements;
+
+// private DataType<List<DataType<XMLType>>> unwrappedInputType;
+//
+// private DataType<XMLType> unwrappedOutputType;
+
+ private transient WrapperInfo wrapperInfo;
+
+ private List<XmlSchemaElement> getChildElements(XmlSchemaElement element) throws InvalidWSDLException {
+ if (element == null) {
+ return null;
+ }
+ if (element.isNillable()) {
+ // Wrapper element cannot be nillable
+ return null;
+ }
+ XmlSchemaType type = element.getSchemaType();
+ if (type == null) {
+ String qName = element.getQName().toString();
+ throw new InvalidWSDLException("The XML schema element does not have a type: " + qName);
+ }
+ if (!(type instanceof XmlSchemaComplexType)) {
+ // Has to be a complexType
+ return null;
+ }
+ XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
+ if (complexType.getAttributes().getCount() != 0 || complexType.getAnyAttribute() != null) {
+ // No attributes
+ return null;
+ }
+ XmlSchemaParticle particle = complexType.getParticle();
+ if (particle == null) {
+ // No particle
+ return Collections.emptyList();
+ }
+ if (!(particle instanceof XmlSchemaSequence)) {
+ return null;
+ }
+ XmlSchemaSequence sequence = (XmlSchemaSequence)complexType.getParticle();
+ XmlSchemaObjectCollection items = sequence.getItems();
+ List<XmlSchemaElement> childElements = new ArrayList<XmlSchemaElement>();
+ for (int i = 0; i < items.getCount(); i++) {
+ XmlSchemaObject schemaObject = items.getItem(i);
+ if (!(schemaObject instanceof XmlSchemaElement)) {
+ return null;
+ }
+ XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
+ if (childElement.getName() == null || childElement.getRefName() != null) {
+ return null;
+ }
+ // TODO: Do we support maxOccurs >1 ?
+ if (childElement.getMaxOccurs() > 1) {
+ return null;
+ }
+ childElements.add(childElement);
+ }
+ return childElements;
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped request element
+ *
+ * @return a list of child XSD elements or null if if the request
+ * element is not wrapped
+ */
+ public List<XmlSchemaElement> getInputChildElements() throws InvalidWSDLException {
+ if (inputElements != null) {
+ return inputElements;
+ }
+ Input input = operation.getInput();
+ if (input != null) {
+ Message inputMsg = input.getMessage();
+ Collection parts = inputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part)parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ return null;
+ }
+ if (!operation.getName().equals(elementName.getLocalPart())) {
+ return null;
+ }
+ inputWrapperElement = getElement(elementName);
+ if (inputWrapperElement == null) {
+ throw new InvalidWSDLException("The element is not declared in a XML schema: " + elementName
+ .toString());
+ }
+ inputElements = getChildElements(inputWrapperElement);
+ return inputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return a list of child XSD elements under the wrapped response
+ * element
+ *
+ * @return a list of child XSD elements or null if if the response
+ * element is not wrapped
+ */
+ public List<XmlSchemaElement> getOutputChildElements() throws InvalidWSDLException {
+ if (outputElements != null) {
+ return outputElements;
+ }
+ Output output = operation.getOutput();
+ if (output != null) {
+ Message outputMsg = output.getMessage();
+ Collection parts = outputMsg.getParts().values();
+ if (parts.size() != 1) {
+ return null;
+ }
+ Part part = (Part)parts.iterator().next();
+ QName elementName = part.getElementName();
+ if (elementName == null) {
+ throw new InvalidWSDLException("The element is not declared in the XML schema: " + part.getName());
+ }
+ outputWrapperElement = WSDLOperation.this.getElement(elementName);
+ if (outputWrapperElement == null) {
+ return null;
+ }
+ outputElements = getChildElements(outputWrapperElement);
+ // FIXME: Do we support multiple child elements for the
+ // response?
+ return outputElements;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @return the inputWrapperElement
+ */
+ public XmlSchemaElement getInputWrapperElement() {
+ return inputWrapperElement;
+ }
+
+ /**
+ * @return the outputWrapperElement
+ */
+ public XmlSchemaElement getOutputWrapperElement() {
+ return outputWrapperElement;
+ }
+
+ /*
+ public DataType<List<DataType<XMLType>>> getUnwrappedInputType() throws InvalidWSDLException {
+ if (unwrappedInputType == null) {
+ List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
+ for (XmlSchemaElement element : getInputChildElements()) {
+ DataType<XMLType> type =
+ new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
+ // type.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ childTypes.add(type);
+ }
+ unwrappedInputType =
+ new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ public DataType<XMLType> getUnwrappedOutputType() throws InvalidServiceContractException {
+ if (unwrappedOutputType == null) {
+ List<XmlSchemaElement> elements = getOutputChildElements();
+ if (elements != null && elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new NotSupportedWSDLException("Multi-part output is not supported");
+ }
+ XmlSchemaElement element = elements.get(0);
+ unwrappedOutputType =
+ new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
+ // unwrappedOutputType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
+ }
+ }
+ return unwrappedOutputType;
+ }
+ */
+
+ public WrapperInfo getWrapperInfo() throws InvalidWSDLException {
+ if (wrapperInfo == null) {
+ ElementInfo in = getElementInfo(getInputWrapperElement());
+ ElementInfo out = getElementInfo(getOutputWrapperElement());
+ List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
+ for (XmlSchemaElement e : getInputChildElements()) {
+ inChildren.add(getElementInfo(e));
+ }
+ List<ElementInfo> outChildren = new ArrayList<ElementInfo>();
+ if (out != null) {
+ for (XmlSchemaElement e : getOutputChildElements()) {
+ outChildren.add(getElementInfo(e));
+ }
+ }
+ wrapperInfo =
+ new WrapperInfo(dataBinding, in, out, inChildren, outChildren);
+ }
+ return wrapperInfo;
+ }
+ }
+
+ private static ElementInfo getElementInfo(XmlSchemaElement element) {
+ if (element == null) {
+ return null;
+ }
+ return new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType()));
+ }
+
+ private static TypeInfo getTypeInfo(XmlSchemaType type) {
+ if (type == null) {
+ return null;
+ }
+ XmlSchemaType baseType = (XmlSchemaType)type.getBaseSchemaType();
+ QName name = type.getQName();
+ boolean simple = (type instanceof XmlSchemaSimpleType);
+ if (baseType == null) {
+ return new TypeInfo(name, simple, null);
+ } else {
+ return new TypeInfo(name, simple, getTypeInfo(baseType));
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java
new file mode 100644
index 0000000000..7de5d5349f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.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.interfacedef.wsdl.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+public interface WSDLConstants {
+
+ String INTERFACE_WSDL = "interface.wsdl";
+ QName INTERFACE_WSDL_QNAME = new QName(Constants.SCA10_NS, "interface.wsdl");
+ String INTERFACE = "interface";
+ String CALLBACK_INTERFACE = "callbackInterface";
+ String WSDL_LOCATION = "wsdlLocation";
+ String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
+ QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
new file mode 100644
index 0000000000..782340982a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+
+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.contribution.service.ContributionRuntimeException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+/**
+ * An ArtifactProcessor for WSDL documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDocumentProcessor implements URLArtifactProcessor<WSDLDefinition> {
+
+ private javax.wsdl.factory.WSDLFactory wsdlFactory;
+ private ExtensionRegistry wsdlExtensionRegistry;
+ private WSDLFactory factory;
+
+ /**
+ * Implementation of a WSDL locator.
+ */
+ private class WSDLLocatorImpl implements WSDLLocator {
+ private InputStream inputStream;
+ private URL base;
+ private String latestImportURI;
+
+ public WSDLLocatorImpl(URL base, InputStream is) {
+ this.base = base;
+ this.inputStream = is;
+ }
+
+ public void close() {
+ }
+
+ public InputSource getBaseInputSource() {
+ return new InputSource(inputStream);
+ }
+
+ public String getBaseURI() {
+ return base.toString();
+ }
+
+ public InputSource getImportInputSource(String parentLocation, String importLocation) {
+ try {
+ URL url = new URL(new URL(parentLocation), importLocation);
+ latestImportURI = url.toString();
+ return new InputSource(url.openStream());
+ } catch (Exception e) {
+ throw new ContributionRuntimeException(e);
+ }
+ }
+
+ public String getLatestImportURI() {
+ return latestImportURI;
+ }
+
+ }
+
+ /**
+ * URI resolver implementation for xml schema
+ */
+ private class URIResolverImpl implements URIResolver {
+
+ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
+ java.lang.String schemaLocation,
+ java.lang.String baseUri) {
+ try {
+ URL url = new URL(new URL(baseUri), schemaLocation);
+ return new InputSource(url.openStream());
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ }
+
+ public WSDLDocumentProcessor(WSDLFactory factory, javax.wsdl.factory.WSDLFactory wsdlFactory) {
+ this.factory = factory;
+
+ if (wsdlFactory != null) {
+ this.wsdlFactory = wsdlFactory;
+ } else {
+ try {
+ this.wsdlFactory = javax.wsdl.factory.WSDLFactory.newInstance();
+ } catch (WSDLException e) {
+ throw new ContributionRuntimeException(e);
+ }
+ }
+
+ wsdlExtensionRegistry = this.wsdlFactory.newPopulatedExtensionRegistry();
+ }
+
+ public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ try {
+
+ // Read a WSDL document
+ InputStream is = artifactURL.openStream();
+ WSDLReader reader = wsdlFactory.newWSDLReader();
+ reader.setFeature("javax.wsdl.verbose", false);
+ reader.setExtensionRegistry(wsdlExtensionRegistry);
+
+ WSDLLocatorImpl locator = new WSDLLocatorImpl(artifactURL, is);
+ Definition definition = reader.readWSDL(locator);
+
+ WSDLDefinition wsdlDefinition = factory.createWSDLDefinition();
+ wsdlDefinition.setDefinition(definition);
+
+ // get base uri for any relative schema includes
+
+
+ // Read inline schemas
+ Types types = definition.getTypes();
+ if (types != null) {
+ wsdlDefinition.getInlinedSchemas().setSchemaResolver(new URIResolverImpl());
+ for (Object ext : types.getExtensibilityElements()) {
+ if (ext instanceof Schema) {
+ Element element = ((Schema)ext).getElement();
+
+ // TODO: fix to make includes in imported
+ // schema work. The XmlSchema library was crashing
+ // because the base uri was not set. This doesn't
+ // affect imports. Need to check that this
+ // is the right approach for XSDs included by a
+ // XSD which is itself imported inline in a WSDL
+ XmlSchemaCollection schemaCollection = wsdlDefinition.getInlinedSchemas();
+ schemaCollection.setBaseUri(((Schema)ext).getDocumentBaseURI());
+
+ wsdlDefinition.getInlinedSchemas().read(element, element.getBaseURI());
+ }
+ }
+ }
+
+ return wsdlDefinition;
+
+ } catch (WSDLException e) {
+ throw new ContributionReadException(e);
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(WSDLDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return ".wsdl";
+ }
+
+ public Class<WSDLDefinition> getModelType() {
+ return WSDLDefinition.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
new file mode 100644
index 0000000000..9f5c83cda6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
@@ -0,0 +1,195 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.wsdl.PortType;
+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.xml.Constants;
+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.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.introspect.WSDLInterfaceIntrospector;
+
+public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants {
+
+ private WSDLFactory wsdlFactory;
+ private WSDLInterfaceIntrospector wsdlIntrospector;
+
+ public WSDLInterfaceProcessor(WSDLFactory wsdlFactory, WSDLInterfaceIntrospector wsdlIntrospector) {
+ this.wsdlFactory = wsdlFactory;
+ this.wsdlIntrospector = wsdlIntrospector;
+ }
+
+ /**
+ * Create a WSDL interface from a URI.
+ * @param uri
+ * @return
+ * @throws ContributionReadException
+ */
+ private WSDLInterface createWSDLInterface(String uri) throws ContributionReadException {
+ WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
+ wsdlInterface.setUnresolved(true);
+
+ // Read a qname in the form:
+ // namespace#wsdl.interface(name)
+ int index = uri.indexOf('#');
+ if (index == -1) {
+ throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
+ }
+ String namespace = uri.substring(0, index);
+ String name = uri.substring(index + 1);
+ name = name.substring("wsdl.interface(".length(), name.length() - 1);
+ wsdlInterface.setName(new QName(namespace, name));
+
+ return wsdlInterface;
+ }
+
+ public WSDLInterfaceContract read(XMLStreamReader reader) throws ContributionReadException {
+ try {
+
+ // Read an <interface.wsdl>
+ WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
+
+ // Read wsdlLocation
+ String location = reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION);
+ wsdlInterfaceContract.setLocation(location);
+
+ String uri = reader.getAttributeValue(null, INTERFACE);
+ if (uri != null) {
+ WSDLInterface wsdlInterface = createWSDLInterface(uri);
+ wsdlInterfaceContract.setInterface(wsdlInterface);
+ }
+
+ uri = reader.getAttributeValue(null, CALLBACK_INTERFACE);
+ if (uri != null) {
+ WSDLInterface wsdlCallbackInterface = createWSDLInterface(uri);
+ wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
+ }
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && INTERFACE_WSDL_QNAME.equals(reader.getName())) {
+ break;
+ }
+ }
+ return wsdlInterfaceContract;
+
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void write(WSDLInterfaceContract wsdlInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException {
+ try {
+ // Write an <interface.wsdl>
+ writer.writeStartElement(Constants.SCA10_NS, INTERFACE_WSDL);
+
+ // Write interface name
+ WSDLInterface wsdlInterface = (WSDLInterface)wsdlInterfaceContract.getInterface();
+ if (wsdlInterface != null) {
+ QName qname = wsdlInterface.getName();
+ String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
+ writer.writeAttribute(INTERFACE, uri);
+ }
+
+ WSDLInterface wsdlCallbackInterface = (WSDLInterface)wsdlInterfaceContract.getCallbackInterface();
+ if (wsdlCallbackInterface != null) {
+ QName qname = wsdlCallbackInterface.getName();
+ String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
+ writer.writeAttribute(CALLBACK_INTERFACE, uri);
+ }
+
+ // Write location
+ if (wsdlInterfaceContract.getLocation() != null) {
+ writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation());
+ }
+
+ writer.writeEndElement();
+
+ } catch (XMLStreamException e) {
+ throw new ContributionWriteException(e);
+ }
+ }
+
+ private WSDLInterface resolveWSDLInterface(WSDLInterface wsdlInterface, ModelResolver resolver) throws ContributionResolveException {
+
+ if (wsdlInterface != null && wsdlInterface.isUnresolved()) {
+
+ // Resolve the WSDL interface
+ wsdlInterface = resolver.resolveModel(WSDLInterface.class, wsdlInterface);
+ if (wsdlInterface.isUnresolved()) {
+
+ // If the WSDL interface has never been resolved yet, do it now
+ // First, resolve the WSDL definition for the given namespace
+ WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+ wsdlDefinition.setUnresolved(true);
+ wsdlDefinition.setNamespace(wsdlInterface.getName().getNamespaceURI());
+ wsdlDefinition = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
+ if (!wsdlDefinition.isUnresolved()) {
+ PortType portType = wsdlDefinition.getDefinition().getPortType(wsdlInterface.getName());
+ if (portType != null) {
+
+ // Introspect the WSDL portType and add the resulting
+ // WSDLInterface to the resolver
+ try {
+ wsdlInterface = wsdlIntrospector.introspect(portType, wsdlDefinition.getInlinedSchemas(), resolver);
+ } catch (InvalidInterfaceException e) {
+ throw new ContributionResolveException(e);
+ }
+ resolver.addModel(wsdlInterface);
+ wsdlInterface.setWsdlDefinition(wsdlDefinition);
+ }
+ }
+ }
+ }
+ return wsdlInterface;
+ }
+
+ public void resolve(WSDLInterfaceContract wsdlInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
+
+ // Resolve the interface and callback interface
+ WSDLInterface wsdlInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getInterface(), resolver);
+ wsdlInterfaceContract.setInterface(wsdlInterface);
+
+ WSDLInterface wsdlCallbackInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getCallbackInterface(), resolver);
+ wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
+ }
+
+ public QName getArtifactType() {
+ return WSDLConstants.INTERFACE_WSDL_QNAME;
+ }
+
+ public Class<WSDLInterfaceContract> getModelType() {
+ return WSDLInterfaceContract.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java
new file mode 100644
index 0000000000..d80f24b74a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XSDDocumentProcessor.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.wsdl.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URI;
+import java.net.URL;
+
+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.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.xml.sax.InputSource;
+
+/**
+ * An ArtifactProcessor for XSD documents.
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDDocumentProcessor implements URLArtifactProcessor<XSDefinition> {
+
+ private WSDLFactory factory;
+
+ /**
+ * URI resolver implementation for xml schema
+ */
+ private class URIResolverImpl implements URIResolver {
+
+ public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
+ java.lang.String schemaLocation,
+ java.lang.String baseUri) {
+ try {
+ URL url = new URL(new URL(baseUri), schemaLocation);
+ return new InputSource(url.openStream());
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ }
+
+ public XSDDocumentProcessor(WSDLFactory factory) {
+ this.factory = factory;
+ }
+
+ public XSDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
+ try {
+
+ // Read an XSD document
+ InputStream is = artifactURL.openStream();
+ try {
+
+ XmlSchemaCollection collection = new XmlSchemaCollection();
+ collection.setSchemaResolver(new URIResolverImpl());
+ XmlSchema schema = collection.read(new InputStreamReader(is), null);
+
+ XSDefinition xsDefinition = factory.createXSDefinition();
+ xsDefinition.setSchema(schema);
+
+ return xsDefinition;
+ } finally {
+ is.close();
+ }
+
+ } catch (IOException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(XSDefinition model, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public String getArtifactType() {
+ return ".xsd";
+ }
+
+ public Class<XSDefinition> getModelType() {
+ return XSDefinition.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospectorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospectorTestCase.java
new file mode 100644
index 0000000000..55a9b1a068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/DefaultWSDLInterfaceIntrospectorTestCase.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.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
+
+/**
+ * Test case for InterfaceWSDLIntrospectorImpl
+ */
+public class DefaultWSDLInterfaceIntrospectorTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDocumentProcessor registry;
+ private PortType portType;
+ private ModelResolver resolver;
+ private WSDLDefinition definition;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDocumentProcessor(new DefaultWSDLFactory(), null);
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ definition = registry.read(null, new URI("stockquote.wsdl"), url);
+ portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ }
+
+ @SuppressWarnings("unchecked")
+ public final void testIntrospectPortType() throws InvalidInterfaceException {
+ DefaultWSDLInterfaceIntrospector introspector = new DefaultWSDLInterfaceIntrospector(new DefaultWSDLFactory());
+ WSDLInterface contract = introspector.introspect(portType, definition.getInlinedSchemas(), resolver);
+ Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType");
+ List<Operation> operations = contract.getOperations();
+ Assert.assertEquals(1, operations.size());
+ Operation operation = operations.get(0);
+ Assert.assertEquals("getLastTradePrice", operation.getName());
+ DataType<List<DataType>> inputType = operation.getInputType();
+ Assert.assertEquals(1, inputType.getLogical().size());
+ DataType<XMLType> returnType = operation.getOutputType();
+ Assert.assertNotNull(returnType);
+ Assert.assertEquals(0, operation.getFaultTypes().size());
+ // Assert.assertEquals(1,
+ // operation.getWrapper().getInputChildElements().size());
+ // Assert.assertEquals(1,
+ // operation.getWrapper().getOutputChildElements().size());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/TestModelResolver.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/TestModelResolver.java
new file mode 100644
index 0000000000..b9a9ba8cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/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.interfacedef.wsdl.introspect;
+
+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(ClassLoader classLoader) {
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationTestCase.java
new file mode 100644
index 0000000000..6bf9628390
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationTestCase.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.sca.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WSDLOperationTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME =
+ new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDocumentProcessor processor;
+ private ModelResolver resolver;
+ private WSDLFactory wsdlFactory;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ processor = new WSDLDocumentProcessor(new DefaultWSDLFactory(), null);
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ wsdlFactory = new DefaultWSDLFactory();
+ }
+
+ @SuppressWarnings("unchecked")
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("stockquote.wsdl"), url);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+
+ WSDLOperation op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+
+ DataType<List<DataType>> inputType = op.getInputType();
+ Assert.assertEquals(1, inputType.getLogical().size());
+ DataType<XMLType> type = inputType.getLogical().get(0);
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), type.getLogical().getElementName());
+
+ DataType<XMLType> outputType = op.getOutputType();
+ Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"),
+ outputType.getLogical().getElementName());
+ Assert.assertTrue(op.isWrapperStyle());
+
+ DataType<List<DataType>> unwrappedInputType = op.getWrapper().getWrapperInfo().getUnwrappedInputType();
+ List<DataType> childTypes = unwrappedInputType.getLogical();
+ Assert.assertEquals(1, childTypes.size());
+ DataType<XMLType> childType = childTypes.get(0);
+ Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical().getElementName());
+
+ childType = op.getWrapper().getWrapperInfo().getUnwrappedOutputType();
+ Assert.assertEquals(new QName(null, "price"), childType.getLogical().getElementName());
+ }
+
+ public final void testUnwrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperation op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getInputType().getLogical().size());
+
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ Assert.assertEquals(2, op.getInputType().getLogical().size());
+ }
+
+ public final void testInvalidWSDL() throws Exception {
+ URL url = getClass().getResource("../xml/invalid-stockquote.wsdl");
+ WSDLDefinition definition = processor.read(null, new URI("invalid-stockquote.wsdl"), url);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperation op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+
+ try {
+ op.isWrapperStyle();
+ fail("InvalidWSDLException should have been thrown");
+ } catch (InvalidWSDLException e) {
+ // Expected
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
new file mode 100644
index 0000000000..ea95537bd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.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.interfacedef.wsdl.introspect;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;
+
+/**
+ * Test case for WSDLOperation
+ */
+public class WrapperStyleOperationTestCase extends TestCase {
+ private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
+
+ private WSDLDocumentProcessor registry;
+ private ModelResolver resolver;
+ private WSDLFactory wsdlFactory;
+
+ /**
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ registry = new WSDLDocumentProcessor(new DefaultWSDLFactory(), null);
+ resolver = new TestModelResolver(getClass().getClassLoader());
+ wsdlFactory = new DefaultWSDLFactory();
+ }
+
+ public final void testWrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/stockquote.wsdl");
+ WSDLDefinition definition = registry.read(null, new URI("stockquote.wsdl"), url);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice", null, null);
+ WSDLOperation op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+ Assert.assertTrue(op.isWrapperStyle());
+ Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
+ Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
+ }
+
+ public final void testUnwrappedOperation() throws Exception {
+ URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
+ WSDLDefinition definition = registry.read(null, new URI("unwrapped-stockquote.wsdl"), url);
+ PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
+ Operation operation = portType.getOperation("getLastTradePrice1", null, null);
+ WSDLOperation op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ operation = portType.getOperation("getLastTradePrice2", null, null);
+ op = new WSDLOperation(wsdlFactory, operation, definition.getInlinedSchemas(), "org.w3c.dom.Node", resolver);
+ Assert.assertFalse(op.isWrapperStyle());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
new file mode 100644
index 0000000000..56355afb2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultSCABindingFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory assemblyFactory;
+ private SCABindingFactory scaBindingFactory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ assemblyFactory = new DefaultAssemblyFactory();
+ scaBindingFactory = new DefaultSCABindingFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ WSDLInterfaceProcessor wsdlProcessor = new WSDLInterfaceProcessor(new DefaultWSDLFactory(), null);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ assemblyFactory = null;
+ mapper = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ ComponentTypeProcessor componentTypeProcessor = new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ComponentType componentType = componentTypeProcessor.read(reader);
+ assertNotNull(componentType);
+
+ //new PrintUtil(System.out).print(componentType);
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ ConstrainingTypeProcessor constrainingTypeProcessor = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ ConstrainingType constrainingType = constrainingTypeProcessor.read(reader);
+ assertNotNull(constrainingType);
+
+ //new PrintUtil(System.out).print(constrainingType);
+ }
+
+ public void testReadComposite() throws Exception {
+ CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory, mapper, staxProcessor);
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+ Composite composite = compositeProcessor.read(reader);
+ assertNotNull(composite);
+
+ CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, mapper, null);
+ compositeUtil.build(composite);
+
+ //new PrintUtil(System.out).print(composite);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
new file mode 100644
index 0000000000..fb71175931
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+
+/**
+ * Test reading WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultURLArtifactProcessorExtensionPoint documentProcessors;
+ ExtensibleURLArtifactProcessor documentProcessor;
+
+ public void setUp() throws Exception {
+ inputFactory = XMLInputFactory.newInstance();
+ documentProcessors = new DefaultURLArtifactProcessorExtensionPoint();
+ documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors);
+
+ WSDLDocumentProcessor wsdlProcessor = new WSDLDocumentProcessor(new DefaultWSDLFactory(), null);
+ documentProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ documentProcessors = null;
+ }
+
+ public void testReadWSDLDocument() throws Exception {
+ URL url = getClass().getResource("example.wsdl");
+ WSDLDefinition definition = documentProcessor.read(null, new URI("example.wsdl"), url, WSDLDefinition.class);
+ assertNotNull(definition);
+ assertNotNull(definition.getDefinition());
+ assertEquals(definition.getNamespace(), "http://www.example.org");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
new file mode 100644
index 0000000000..99fca23b7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.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.sca.interfacedef.wsdl.xml;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+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.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;
+import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading/write WSDL interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ XMLInputFactory inputFactory;
+ DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+ private ExtensibleStAXArtifactProcessor staxProcessor;
+ private AssemblyFactory factory;
+ private PolicyFactory policyFactory;
+ private InterfaceContractMapper mapper;
+
+ public void setUp() throws Exception {
+ factory = new DefaultAssemblyFactory();
+ policyFactory = new DefaultPolicyFactory();
+ mapper = new InterfaceContractMapperImpl();
+ inputFactory = XMLInputFactory.newInstance();
+ staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
+ staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+
+ staxProcessors.addArtifactProcessor(new CompositeProcessor(factory, policyFactory, mapper, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+ staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+
+ WSDLInterfaceProcessor wsdlProcessor = new WSDLInterfaceProcessor(new DefaultWSDLFactory(), null);
+ staxProcessors.addArtifactProcessor(wsdlProcessor);
+ }
+
+ public void tearDown() throws Exception {
+ inputFactory = null;
+ staxProcessors = null;
+ policyFactory = null;
+ factory = null;
+ mapper = null;
+ }
+
+ public void testReadWriteComponentType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+ assertNotNull(componentType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(componentType, bos);
+ }
+
+ public void testReadWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+ assertNotNull(constrainingType);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(constrainingType, bos);
+ }
+
+ public void testReadWriteComposite() throws Exception {
+ InputStream is = getClass().getResourceAsStream("Calculator.composite");
+ Composite composite = staxProcessor.read(is, Composite.class);
+ assertNotNull(composite);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ staxProcessor.write(composite, bos);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite
new file mode 100644
index 0000000000..875fdf35d2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
new file mode 100644
index 0000000000..3eb81b61bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
@@ -0,0 +1,36 @@
+<?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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://calc"
+ targetNamespace="http://calc"
+ xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
+ name="CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ </reference>
+
+</constrainingType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType
new file mode 100644
index 0000000000..aea7046a3d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.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:wsdli="http://www.w3.org/2004/08/wsdl-instance">
+
+ <service name="CalculatorService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
+ wsdli:wsdlLocation="http://tempuri.org"/>
+ </service>
+
+ <reference name="divideService">
+ <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
+ </reference>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl
new file mode 100644
index 0000000000..5e8e5dad0d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl
@@ -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.
+-->
+<wsdl:definitions targetNamespace="http://www.example.org"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ name="example">
+
+ <wsdl:portType name="HelloWorld">
+ </wsdl:portType>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
new file mode 100644
index 0000000000..ad81fc7867
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice1">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd
new file mode 100644
index 0000000000..241ec15d36
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
new file mode 100644
index 0000000000..39cd5547d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
@@ -0,0 +1,58 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput" />
+ <output message="tns:GetLastTradePriceOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl
new file mode 100644
index 0000000000..06bdc5510c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl
@@ -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.
+-->
+<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:import location="test2.wsdl" namespace="http://helloworld"></wsdl:import>
+
+ <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-1.0-SNAPSHOT/services/HelloWorldWebService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
new file mode 100644
index 0000000000..c2210f4a94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
@@ -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.
+-->
+<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:ipo="http://www.example.com/IPO" xmlns:tns="http://www.example.com/Customer">
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <complexType name="Customer">
+ <sequence>
+ <element name="customerID" type="string"></element>
+ <element name="name" type="string"></element>
+ <element name="order" type="ipo:PurchaseOrderType" />
+ </sequence>
+ </complexType>
+ <element name="customer" type="tns:Customer"></element>
+
+</schema>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl
new file mode 100644
index 0000000000..529b395fd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl
@@ -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.
+-->
+<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">
+
+ <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
+
+ <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:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl
new file mode 100644
index 0000000000..666a7e4069
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl
@@ -0,0 +1,76 @@
+<?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="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
+ xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
+ <element name="getLastTradePrice">
+ <complexType>
+ <sequence>
+ <element name="tickerSymbol" type="string" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="getLastTradePriceResponse">
+ <complexType>
+ <sequence>
+ <element name="price" type="float" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="GetLastTradePriceInput1">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ </message>
+
+ <message name="GetLastTradePriceOutput1">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <message name="GetLastTradePriceInput2">
+ <part name="body" element="xsd1:getLastTradePrice" />
+ <part name="other" type="xsd:string"/>
+ </message>
+
+ <message name="GetLastTradePriceOutput2">
+ <part name="body" element="xsd1:getLastTradePriceResponse" />
+ </message>
+
+ <portType name="StockQuotePortType">
+ <operation name="getLastTradePrice">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice1">
+ <input message="tns:GetLastTradePriceInput1" />
+ <output message="tns:GetLastTradePriceOutput1" />
+ </operation>
+ <operation name="getLastTradePrice2">
+ <input message="tns:GetLastTradePriceInput2" />
+ <output message="tns:GetLastTradePriceOutput2" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/.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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/pom.xml
new file mode 100644
index 0000000000..3993470efb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface-wsdl</artifactId>
+ <name>Apache Tuscany WSDL Interface Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <!-- Apache repository for Web Services artifacts -->
+ <repository>
+ <id>apache.ws.zone</id>
+ <name>Apache WS Zone Repository</name>
+ <url>http://ws.zones.apache.org/repository2</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java
new file mode 100644
index 0000000000..8f75de59e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.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.interfacedef.wsdl;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLFactoryImpl;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultWSDLFactory extends WSDLFactoryImpl implements WSDLFactory {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
new file mode 100644
index 0000000000..2cbc04bd54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.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.interfacedef.wsdl;
+
+import javax.wsdl.Definition;
+
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+/**
+ * Represents a WSDL definition.
+ * WSDLDefinition
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLDefinition {
+
+ /**
+ * Returns the WSDL definition model
+ * @return the WSDL definition model
+ */
+ Definition getDefinition();
+
+ /**
+ * Sets the WSDL definition model
+ * @param definition the WSDL definition model
+ */
+ void setDefinition(Definition definition);
+
+ /**
+ * Returns a list of XML schemas inlined in this WSDL definition.
+ * @return
+ */
+ XmlSchemaCollection getInlinedSchemas();
+
+ /**
+ * Returns the namespace of this WSDL definition.
+ * @return the namespace of this WSDL definition
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace of this WSDL definition.
+ * @param namespace the namespace of this WSDL definition
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
new file mode 100644
index 0000000000..dfaf06b0be
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.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.interfacedef.wsdl;
+
+/**
+ * Factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLFactory {
+
+ /**
+ * Creates a new WSDL interface.
+ *
+ * @return a new WSDL interface
+ */
+ WSDLInterface createWSDLInterface();
+
+ /**
+ * Creates a new WSDL definition.
+ *
+ * @return a new WSDL definition
+ */
+ WSDLDefinition createWSDLDefinition();
+
+ /**
+ * Creates a new XML Schema definition.
+ *
+ * @return a new XML Schema definition
+ */
+ XSDefinition createXSDefinition();
+
+ /**
+ * Creates a new WSDL interface contract.
+ *
+ * @return
+ */
+ WSDLInterfaceContract createWSDLInterfaceContract();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java
new file mode 100644
index 0000000000..92bebed7de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.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.sca.interfacedef.wsdl;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+
+
+/**
+ * Represents a WSDL interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLInterface extends Interface {
+
+ /**
+ * Returns the name of the WSDL interface.
+ *
+ * @return the name of the WSDL interface
+ */
+ QName getName();
+
+ /**
+ * Sets the name of the WSDL interface.
+ *
+ * @param className the name of the WSDL interface
+ */
+ void setName(QName interfaceName);
+
+ /**
+ * Returns the WSDL interface portType.
+ *
+ * @return the WSDL interface portType
+ */
+ PortType getPortType();
+
+ /**
+ * Sets the WSDL interface portType
+ *
+ * @param portType the WSDL interface portType
+ */
+ void setPortType(PortType portType);
+
+ public WSDLDefinition getWsdlDefinition();
+
+ public void setWsdlDefinition(WSDLDefinition wsdlDefinition);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java
new file mode 100644
index 0000000000..59db17116b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.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.interfacedef.wsdl;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+
+/**
+ * Represents a WSDL interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface WSDLInterfaceContract extends InterfaceContract {
+
+ /**
+ * Sets the WSDL location.
+ * @param location the WSDL location
+ */
+ void setLocation(String location);
+
+ /**
+ * Returns the WSDL location
+ * @return the WSDL location
+ */
+ String getLocation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.java
new file mode 100644
index 0000000000..99bd23de25
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/XSDefinition.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.interfacedef.wsdl;
+
+import org.apache.ws.commons.schema.XmlSchema;
+
+/**
+ * Represents an XML Schema definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface XSDefinition {
+
+ /**
+ * Returns the XmlSchema definition model
+ * @return the XmlSchema definition model
+ */
+ XmlSchema getSchema();
+
+ /**
+ * Sets the XmlSchema definition model
+ * @param definition the XmlSchema definition model
+ */
+ void setSchema(XmlSchema definition);
+
+ /**
+ * Returns the namespace of this XmlSchema definition.
+ * @return the namespace of this XmlSchema definition
+ */
+ String getNamespace();
+
+ /**
+ * Sets the namespace of this XmlSchema definition.
+ * @param namespace the namespace of this XmlSchema definition
+ */
+ void setNamespace(String namespace);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
new file mode 100644
index 0000000000..d5d61d2bf1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.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.sca.interfacedef.wsdl.impl;
+
+import javax.wsdl.Definition;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+/**
+ * Represents a WSDL definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLDefinitionImpl implements WSDLDefinition {
+
+ private Definition definition;
+ private String namespace;
+ private XmlSchemaCollection inlineSchemas = new XmlSchemaCollection();
+ private boolean unresolved;
+
+ protected WSDLDefinitionImpl() {
+ }
+
+ public Definition getDefinition() {
+ return definition;
+ }
+
+ public void setDefinition(Definition definition) {
+ this.definition = definition;
+ }
+
+ public XmlSchemaCollection getInlinedSchemas() {
+ return inlineSchemas;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public String getNamespace() {
+ if (isUnresolved()) {
+ return namespace;
+ } else if (definition != null) {
+ return definition.getTargetNamespace();
+ } else {
+ return null;
+ }
+ }
+
+ public void setNamespace(String namespace) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ } else {
+ this.namespace = namespace;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getNamespace()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof WSDLDefinition) {
+ if (getNamespace() != null) {
+ return getNamespace().equals(((WSDLDefinition)obj).getNamespace());
+ } else {
+ return ((WSDLDefinition)obj).getNamespace() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
new file mode 100644
index 0000000000..4639d2187e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.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.interfacedef.wsdl.impl;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+
+/**
+ * A factory for the WSDL model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class WSDLFactoryImpl implements WSDLFactory {
+
+ public WSDLInterface createWSDLInterface() {
+ return new WSDLInterfaceImpl();
+ }
+
+ public WSDLDefinition createWSDLDefinition() {
+ return new WSDLDefinitionImpl();
+ }
+
+ public WSDLInterfaceContract createWSDLInterfaceContract() {
+ return new WSDLInterfaceContractImpl();
+ }
+
+ public XSDefinition createXSDefinition() {
+ return new XSDefinitionImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java
new file mode 100644
index 0000000000..a34cbe35b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.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.sca.interfacedef.wsdl.impl;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
+
+/**
+ * Represents a WSDL interface contract.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements WSDLInterfaceContract {
+ private String location;
+
+ protected WSDLInterfaceContractImpl() {
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
new file mode 100644
index 0000000000..31286147aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.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.interfacedef.wsdl.impl;
+
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+
+/**
+ * Represents a WSDL interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface {
+
+ private QName name;
+ private PortType portType;
+ private WSDLDefinition wsdlDefinition;
+
+ protected WSDLInterfaceImpl() {
+ setRemotable(true);
+ }
+
+ public QName getName() {
+ if (isUnresolved()) {
+ return name;
+ } else {
+ return portType.getQName();
+ }
+ }
+
+ public void setName(QName interfaceName) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ }
+ this.name = interfaceName;
+ }
+
+ public PortType getPortType() {
+ return portType;
+ }
+
+ public void setPortType(PortType portType) {
+ this.portType = portType;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof WSDLInterface) {
+ if (getName() != null) {
+ return getName().equals(((WSDLInterface)obj).getName());
+ } else {
+ return ((WSDLInterface)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public WSDLDefinition getWsdlDefinition() {
+ return wsdlDefinition;
+ }
+
+ public void setWsdlDefinition(WSDLDefinition wsdlDefinition) {
+ this.wsdlDefinition = wsdlDefinition;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.java
new file mode 100644
index 0000000000..d4ed9538e7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/XSDefinitionImpl.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.interfacedef.wsdl.impl;
+
+import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
+import org.apache.ws.commons.schema.XmlSchema;
+
+/**
+ * Represents a XML schema definition.
+ *
+ * @version $Rev$ $Date$
+ */
+public class XSDefinitionImpl implements XSDefinition {
+
+ private XmlSchema definition;
+ private String namespace;
+ private boolean unresolved;
+
+ protected XSDefinitionImpl() {
+ }
+
+ public XmlSchema getSchema() {
+ return definition;
+ }
+
+ public void setSchema(XmlSchema definition) {
+ this.definition = definition;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ public String getNamespace() {
+ if (isUnresolved()) {
+ return namespace;
+ } else if (definition != null) {
+ return definition.getTargetNamespace();
+ } else {
+ return null;
+ }
+ }
+
+ public void setNamespace(String namespace) {
+ if (!isUnresolved()) {
+ throw new IllegalStateException();
+ } else {
+ this.namespace = namespace;
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getNamespace()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof XSDefinition) {
+ if (getNamespace() != null) {
+ return getNamespace().equals(((XSDefinition)obj).getNamespace());
+ } else {
+ return ((XSDefinition)obj).getNamespace() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/.checkstyle b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.checkstyle
new file mode 100644
index 0000000000..e3c216986d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.checkstyle
@@ -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.
+-->
+<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/sca-java-1.x/branches/sca-java-0.90/modules/interface/.pmd b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.pmd
new file mode 100644
index 0000000000..2db10d6a6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.pmd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<pmd><useProjectRuleSet>true</useProjectRuleSet><rules/><includeDerivedFiles>false</includeDerivedFiles></pmd> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/.ruleset b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.ruleset
new file mode 100644
index 0000000000..ba9b5ce886
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/.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/sca-java-1.x/branches/sca-java-0.90/modules/interface/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/interface/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/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/sca-java-1.x/branches/sca-java-0.90/modules/interface/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/interface/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/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/sca-java-1.x/branches/sca-java-0.90/modules/interface/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/interface/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/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/sca-java-1.x/branches/sca-java-0.90/modules/interface/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/interface/pom.xml
new file mode 100644
index 0000000000..a5a5f90fe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-interface</artifactId>
+ <name>Apache Tuscany Interface Model</name>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java
new file mode 100644
index 0000000000..ce00834572
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.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.interfacedef;
+
+public enum ConversationSequence {
+ CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java
new file mode 100644
index 0000000000..2503c80f86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.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.interfacedef;
+
+
+/**
+ * Representation of the type of data associated with an operation. Data is
+ * represented in two forms: the physical form used by the runtime and a logical
+ * form used by the assembly. The physical form is a Java Type because the
+ * runtime is written in Java. This may be the same form used by the application
+ * but it may not; for example, an application that is performing stream
+ * processing may want a physical form such as an
+ * {@link java.io.InputStream InputStream} to semantially operate on application
+ * data such as a purchase order. The logical description is that used by the
+ * assembly model and is an identifier into some well-known type space; examples
+ * may be a Java type represented by its Class or an XML type represented by its
+ * QName. Every data type may also contain metadata describing the expected
+ * data; for example, it could specify a preferred data binding technology or
+ * the size of a typical instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface DataType<L> extends Cloneable {
+ /**
+ * Set the java type for the data
+ * @param cls
+ */
+ void setPhysical(Class cls);
+
+ /**
+ * Returns the physical type used by the runtime.
+ *
+ * @return the physical type used by the runtime
+ */
+ Class getPhysical();
+
+ /**
+ * Returns the logical identifier used by the assembly. The type of this
+ * value identifies the logical type system in use. Known values are:
+ * <ul>
+ * <li>a Class identifies a Java type by name and
+ * ClassLoader; this includes Java Classes as they are specializations of
+ * Type</li>
+ * <li>a XMLType identifies an XML type by local name and
+ * namespace</li>
+ * </ul>
+ *
+ * @return the logical type name
+ */
+ L getLogical();
+
+ /**
+ * @return
+ */
+ String getDataBinding();
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ void setDataBinding(String dataBinding);
+
+ /**
+ * @return
+ * @throws CloneNotSupportedException
+ */
+ Object clone() throws CloneNotSupportedException;
+
+ /**
+ * @param logical the logical to set
+ */
+ void setLogical(L logical);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java
new file mode 100644
index 0000000000..cce99b4674
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.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.interfacedef;
+
+/**
+ * Denotes imcompatible service contracts for a wire
+ *
+ * @version $Rev$ $Date$
+ */
+public class IncompatibleInterfaceContractException extends Exception {
+ private static final long serialVersionUID = 5127478601823295587L;
+ private final InterfaceContract source;
+ private final InterfaceContract target;
+ private final Operation sourceOperation;
+ private final Operation targetOperation;
+
+ public IncompatibleInterfaceContractException(String message, InterfaceContract source, InterfaceContract target) {
+ super(message);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = null;
+ this.targetOperation = null;
+ }
+
+ public IncompatibleInterfaceContractException(String message,
+ InterfaceContract source,
+ InterfaceContract target,
+ Operation sourceOperation,
+ Operation targetOperation) {
+ super(message);
+ this.source = source;
+ this.target = target;
+ this.sourceOperation = sourceOperation;
+ this.targetOperation = targetOperation;
+ }
+
+ public InterfaceContract getTarget() {
+ return target;
+ }
+
+ public InterfaceContract getSource() {
+ return source;
+ }
+
+ public Operation getSourceOperation() {
+ return sourceOperation;
+ }
+
+ public Operation getTargetOperation() {
+ return targetOperation;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
new file mode 100644
index 0000000000..4919ffcb2b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.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.sca.interfacedef;
+
+import java.util.List;
+
+/**
+ * Represents a service interface. This interface will typically be extended to
+ * support concrete interface type systems, such as Java interfaces, WSDL 1.1
+ * portTypes and WSDL 2.0 interfaces.
+ */
+public interface Interface {
+
+ /**
+ * Returns true if the interface is a remotable interface..
+ *
+ * @return true if the interface is a remotable interface
+ */
+ boolean isRemotable();
+
+ /**
+ * Sets whether the interface is a remotable or local interface.
+ *
+ * @param remotable indicates whether the interface is remotable or local
+ */
+ void setRemotable(boolean remotable);
+
+
+ // FIXME: [rfeng] We need to re-consider the conversational as an intent
+ /**
+ * Test if the interface is conversational
+ * @return
+ */
+ boolean isConversational();
+
+ /**
+ * Set whether the interface is conversational
+ * @param conversational
+ */
+ void setConversational(boolean conversational);
+
+ /**
+ * Returns the operations defined on this interface.
+ *
+ * @return the operations defined on this interface
+ */
+ List<Operation> getOperations();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ // TODO: [rfeng] We might need to have a better way
+ /**
+ * Set the databinding for the interface
+ * @param dataBinding
+ */
+ void setDefaultDataBinding(String dataBinding);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java
new file mode 100644
index 0000000000..9821a461d7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.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.sca.interfacedef;
+
+
+/**
+ * Interface contracts define one or more business functions. These business
+ * functions are provided by services and are used by references.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceContract {
+
+ /**
+ * Returns the interface definition representing the interface for
+ * invocations from the requestor to the provider.
+ *
+ * @return the interface definition representing the interface for
+ * invocations from the requestor to the provider
+ */
+ Interface getInterface();
+
+ /**
+ * Sets the interface definition representing the interface for invocations
+ * from the requestor to the provider.
+ *
+ * @param callInterface the interface definition representing the interface
+ * for invocations from the requestor to the provider
+ */
+ void setInterface(Interface callInterface);
+
+ /**
+ * Returns the interface definition representing the interface for
+ * invocations from the provider to the requestor.
+ *
+ * @return the interface definition representing the interface for
+ * invocations from the provider to the requestor.
+ */
+ Interface getCallbackInterface();
+
+ /**
+ * Sets the interface definition representing the interface for invocations
+ * from the provider to the requestor.
+ *
+ * @param callbackInterface the interface definition representing the
+ * interface for invocations from the provider to the requestor.
+ */
+ void setCallbackInterface(Interface callbackInterface);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
new file mode 100644
index 0000000000..54edd3015a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.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.sca.interfacedef;
+
+/**
+ * The InterfaceContractMapper is responsible to match interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+public interface InterfaceContractMapper {
+ /**
+ * Check the compatiblity of the source and the target interface contracts.
+ * <p>
+ * A wire may only connect a source to a target if the target implements an
+ * interface that is compatible with the interface required by the source.
+ * The source and the target are compatible if: <p/>
+ * <ol>
+ * <li>the source interface and the target interface MUST either both be
+ * remotable or they are both local
+ * <li>the methods on the target interface MUST be the same as or be a
+ * superset of the methods in the interface specified on the source
+ * <li>compatibility for the individual method is defined as compatibility
+ * of the signature, that is method name, input types, and output types MUST
+ * BE the same.
+ * <li>the order of the input and output types also MUST BE the same.
+ * <li>the set of Faults and Exceptions expected by the source MUST BE the
+ * same or be a superset of those specified by the service.
+ * <li>other specified attributes of the two interfaces MUST match,
+ * including Scope and Callback interface
+ * </ol>
+ * <p/>
+ * <p>
+ * Please note this test is not symetric: the success of isCompatible(A, B)
+ * does NOT imply isCompatible(B, A)
+ *
+ * @param source The source interface contract
+ * @param target The target interface contract
+ * @return true if the source contract can be supported by the target
+ * contract
+ */
+ boolean isCompatible(InterfaceContract source, InterfaceContract target);
+
+ /**
+ * @param source
+ * @param target
+ * @param ignoreCallback
+ * @param silent
+ * @return
+ * @throws IncompatibleInterfaceContractException
+ */
+ boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleInterfaceContractException;
+
+ /**
+ * Test if the source data type is compatible with the target data type. The
+ * compatibility is defined as follows.
+ * <ul>
+ * <li>source's logical type is either the same or subtype of the target's
+ * logical type
+ * </ul>
+ * For example, if the source type is a SDO Customer and the target type is
+ * a JAXB Customer and both Customer are generated from the same XSD type.
+ *
+ * @param source The source data type
+ * @param target The target data type
+ * @return
+ */
+ boolean isCompatible(DataType source, DataType target, boolean remotable);
+
+ /**
+ * Check if source operation is compatible with the target operation
+ *
+ * @param source The source operation
+ * @param target The target operation
+ * @return true if the source operation is compatible with the target
+ * operation
+ */
+ boolean isCompatible(Operation source, Operation target, boolean remotable);
+
+ /**
+ * @param source
+ * @param target
+ * @return
+ */
+ boolean isCompatible(Interface source, Interface target);
+
+ /**
+ * Map the source operation to a compatible operation in the target
+ * interface
+ *
+ * @param target The target interface
+ * @param source The source operation
+ * @return A compatible operation
+ */
+ Operation map(Interface target, Operation source);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java
new file mode 100644
index 0000000000..f952a86478
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.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.interfacedef;
+
+
+/**
+ * Denotes an illegal callback interface
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class InvalidCallbackException extends InvalidInterfaceException {
+ private static final long serialVersionUID = 2727755895702116397L;
+
+ public InvalidCallbackException(String message) {
+ super(message);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java
new file mode 100644
index 0000000000..c4b2dd240d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.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.interfacedef;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public abstract class InvalidInterfaceException extends Exception {
+
+ public InvalidInterfaceException() {
+ }
+
+ public InvalidInterfaceException(String message) {
+ super(message);
+ }
+
+ public InvalidInterfaceException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidInterfaceException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java
new file mode 100644
index 0000000000..b19805c5b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.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.sca.interfacedef;
+
+import java.lang.reflect.Method;
+
+/**
+ * Denotes an invalid conversational interface definition
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidOperationException extends InvalidInterfaceException {
+
+ private static final long serialVersionUID = -1797615361821517091L;
+ private final Method operation;
+
+ public InvalidOperationException(String message, Method operation) {
+ super(message);
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java
new file mode 100644
index 0000000000..f127b3cbaa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.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.sca.interfacedef;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents an operation on a service interface.
+ */
+public interface Operation {
+ /**
+ * Returns the name of the operation.
+ *
+ * @return the name of the operation
+ */
+ String getName();
+
+ /**
+ * Sets the name of the operation.
+ *
+ * @param name the name of the operation
+ */
+ void setName(String name);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+ /**
+ * Get the data type that represents the input of this operation. The logic
+ * type is a list of data types and each element represents a parameter
+ *
+ * @return the inputType
+ */
+ DataType<List<DataType>> getInputType();
+
+ /**
+ * @param inputType
+ */
+ void setInputType(DataType<List<DataType>> inputType);
+
+ /**
+ * Get the data type for the output
+ *
+ * @return the outputType
+ */
+ DataType getOutputType();
+
+ /**
+ * @param outputType
+ */
+ void setOutputType(DataType outputType);
+
+ /**
+ * Get a list of data types to represent the faults/exceptions
+ *
+ * @return the faultTypes
+ */
+ List<DataType> getFaultTypes();
+
+ /**
+ * @param faultTypes
+ */
+ void setFaultTypes(List<DataType> faultTypes);
+
+ /**
+ * Get the owning interface
+ * @return
+ */
+ Interface getInterface();
+
+ /**
+ * Set the owning interface
+ * @param interfaze
+ */
+ void setInterface(Interface interfaze);
+
+ /**
+ * Get the sequence of the conversation
+ * @return
+ */
+ ConversationSequence getConversationSequence();
+
+ /**
+ * Set the sequence of conversation for the operation
+ * @param sequence
+ */
+ void setConversationSequence(ConversationSequence sequence);
+
+ /**
+ * Indicate if the operation is non-blocking
+ * @return
+ */
+ boolean isNonBlocking();
+
+ /**
+ * Set the operation to be non-blocking
+ */
+ void setNonBlocking(boolean nonBlocking);
+
+ /**
+ * @return the wrapperInfo
+ */
+ WrapperInfo getWrapper();
+
+ /**
+ * @param wrapperInfo the wrapperInfo to set
+ */
+ void setWrapper(WrapperInfo wrapperInfo);
+
+ /**
+ * @return the wrapperStyle
+ */
+ boolean isWrapperStyle();
+
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ void setWrapperStyle(boolean wrapperStyle);
+
+ /**
+ * Get the databinding for the operation
+ * @return
+ */
+ String getDataBinding();
+
+ /**
+ * Set the databinding for the operation
+ * @param dataBinding
+ */
+ void setDataBinding(String dataBinding);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java
new file mode 100644
index 0000000000..424303a4c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.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.sca.interfacedef;
+
+import java.lang.reflect.Method;
+
+/**
+ * Exception thrown to indicate that a service contract specification contains
+ * an overloaded method.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OverloadedOperationException extends InvalidInterfaceException {
+ private static final long serialVersionUID = -4658711318608885638L;
+ private final Method operation;
+
+ public OverloadedOperationException(Method operation) {
+ super();
+ this.operation = operation;
+ }
+
+ public Method getOperation() {
+ return operation;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
new file mode 100644
index 0000000000..3343ce4367
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+
+/**
+ * Representation of the type of data associated with an operation. Data is
+ * represented in two forms: the physical form used by the runtime and a logical
+ * form used by the assembly. The physical form is a Java Type because the
+ * runtime is written in Java. This may be the same form used by the application
+ * but it may not; for example, an application that is performing stream
+ * processing may want a physical form such as an
+ * {@link java.io.InputStream InputStream} to semantially operate on application
+ * data such as a purchase order. The logical description is that used by the
+ * assembly model and is an identifier into some well-known type space; examples
+ * may be a Java type represented by its Class or an XML type represented by its
+ * QName. Every data type may also contain metadata describing the expected
+ * data; for example, it could specify a preferred data binding technology or
+ * the size of a typical instance.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DataTypeImpl<L> implements DataType<L> {
+ private boolean unresolved = true;
+ private String dataBinding;
+ private Class physical;
+ private L logical;
+
+ /**
+ * Construct a data type specifying the physical and logical types.
+ *
+ * @param physical the physical class used by the runtime
+ * @param logical the logical type
+ * @see #getLogical()
+ */
+ public DataTypeImpl(Class physical, L logical) {
+ this.physical = physical;
+ this.logical = logical;
+ }
+
+ public DataTypeImpl(String dataBinding, Class physical, L logical) {
+ this.dataBinding = dataBinding;
+ this.physical = physical;
+ this.logical = logical;
+ }
+
+ /**
+ * Returns the physical type used by the runtime.
+ *
+ * @return the physical type used by the runtime
+ */
+ public Class getPhysical() {
+ return physical;
+ }
+
+ /**
+ * Returns the logical identifier used by the assembly. The type of this
+ * value identifies the logical type system in use. Known values are:
+ * <ul>
+ * <li>a java.lang.reflect.Type identifies a Java type by name and
+ * ClassLoader; this includes Java Classes as they are specializations of
+ * Type</li>
+ * <li>a javax.xml.namespace.QName identifies an XML type by local name and
+ * namespace</li>
+ * </ul>
+ *
+ * @return the logical type name
+ */
+ public L getLogical() {
+ return logical;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ /**
+ * @param dataBinding the dataBinding to set
+ */
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append(physical).append(" ").append(dataBinding).append(" ").append(logical);
+ return sb.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ DataTypeImpl copy = (DataTypeImpl)super.clone();
+ return copy;
+ }
+
+ /**
+ * @param logical the logical to set
+ */
+ public void setLogical(L logical) {
+ this.logical = logical;
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((dataBinding == null) ? 0 : dataBinding.hashCode());
+ result = PRIME * result + ((logical == null) ? 0 : logical.hashCode());
+ result = PRIME * result + ((physical == null) ? 0 : physical.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final DataTypeImpl other = (DataTypeImpl)obj;
+ if (dataBinding == null) {
+ if (other.dataBinding != null) {
+ return false;
+ }
+ } else if (!dataBinding.equals(other.dataBinding)) {
+ return false;
+ }
+ if (logical == null) {
+ if (other.logical != null) {
+ return false;
+ }
+ } else if (!logical.equals(other.logical)) {
+ return false;
+ }
+ if (physical == null) {
+ if (other.physical != null) {
+ return false;
+ }
+ } else if (!physical.equals(other.physical)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the unresolved
+ */
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ /**
+ * @param unresolved the unresolved to set
+ */
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+ /**
+ * @param physical the physical to set
+ */
+ public void setPhysical(Class physical) {
+ this.physical = physical;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java
new file mode 100644
index 0000000000..3fd46ea7b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.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.interfacedef.impl;
+
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+
+/**
+ * Represents an interface contract.
+ * InterfaceContractImpl
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class InterfaceContractImpl implements InterfaceContract {
+ private Interface callInterface;
+ private Interface callbackInterface;
+
+ public Interface getCallbackInterface() {
+ return callbackInterface;
+ }
+
+ public Interface getInterface() {
+ return callInterface;
+ }
+
+ public void setCallbackInterface(Interface callbackInterface) {
+ this.callbackInterface = callbackInterface;
+ }
+
+ public void setInterface(Interface callInterface) {
+ this.callInterface = callInterface;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
new file mode 100644
index 0000000000..b525f70fb8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.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.sca.interfacedef.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class InterfaceContractMapperImpl implements InterfaceContractMapper {
+
+ public boolean isCompatible(DataType source, DataType target, boolean remotable) {
+ if (source == target) {
+ return true;
+ }
+ if (!remotable) {
+ // For local case
+ return target.getPhysical() == source.getPhysical();
+ } else {
+ // FIXME: How to test if two remotable data type is compatible?
+ // return target.getLogical().equals(source.getLogical());
+ return true;
+ }
+
+ }
+
+ public boolean isCompatible(Operation source, Operation target, boolean remotable) {
+ if (source == target) {
+ return true;
+ }
+
+ // Check name
+ if (!source.getName().equals(target.getName())) {
+ return false;
+ }
+
+ // FIXME: We need to deal with wrapped<-->unwrapped conversion
+
+ // Check output type
+ DataType sourceOutputType = source.getOutputType();
+ DataType targetOutputType = target.getOutputType();
+
+ // Note the target output type is now the source for checking
+ // compatibility
+ if (!isCompatible(targetOutputType, sourceOutputType, remotable)) {
+ return false;
+ }
+
+ List<DataType> sourceInputType = source.getInputType().getLogical();
+ if (source.isWrapperStyle()) {
+ sourceInputType = source.getWrapper().getUnwrappedInputType().getLogical();
+ }
+ List<DataType> targetInputType = target.getInputType().getLogical();
+ if (target.isWrapperStyle()) {
+ targetInputType = target.getWrapper().getUnwrappedInputType().getLogical();
+ }
+
+ if (sourceInputType.size() != targetInputType.size()) {
+ return false;
+ }
+
+ int size = sourceInputType.size();
+ for (int i = 0; i < size; i++) {
+ if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), remotable)) {
+ return false;
+ }
+ }
+
+ // Check fault types
+ for (DataType targetFaultType : target.getFaultTypes()) {
+ // Source fault types must be the same or superset of target fault
+ // types
+ boolean found = true;
+ for (DataType sourceFaultType : source.getFaultTypes()) {
+ found = false;
+ if (isCompatible(targetFaultType, sourceFaultType, remotable)) {
+ // Target fault type can be covered by the source fault type
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // FIXME: How to improve the performance for the lookup
+ private Operation getOperation(List<Operation> operations, String name) {
+ for (Operation op : operations) {
+ if (op.getName().equals(name)) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ public boolean checkCompatibility(InterfaceContract source,
+ InterfaceContract target,
+ boolean ignoreCallback,
+ boolean silent) throws IncompatibleInterfaceContractException {
+ if (source == target) {
+ // Shortcut for performance
+ return true;
+ }
+ if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Remotable settings do not match", source, target);
+ } else {
+ return false;
+ }
+ }
+ if (source.getInterface().isConversational() != target.getInterface().isConversational()) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ for (Operation operation : source.getInterface().getOperations()) {
+ Operation targetOperation = map(target.getInterface(), operation);
+ if (targetOperation == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Operation not found on target", source, target);
+ } else {
+ return false;
+ }
+ }
+ if (!source.getInterface().isRemotable()) {
+ // FIXME: for remotable operation, only compare name for now
+ if (!operation.equals(targetOperation)) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Target operations are not compatible",
+ source, target);
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+
+ if (ignoreCallback) {
+ return true;
+ }
+
+ if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
+ return true;
+ }
+ if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Callback interface doesn't match", source, target);
+ } else {
+ return false;
+ }
+ }
+
+ for (Operation operation : source.getCallbackInterface().getOperations()) {
+ Operation targetOperation = getOperation(target.getCallbackInterface().getOperations(), operation.getName());
+ if (targetOperation == null) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Callback operation not found on target", source,
+ target, null, targetOperation);
+ } else {
+ return false;
+ }
+ }
+ if (!operation.equals(targetOperation)) {
+ if (!silent) {
+ throw new IncompatibleInterfaceContractException("Target callback operation is not compatible",
+ source, target, operation, targetOperation);
+ } else {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public boolean isCompatible(Interface source, Interface target) {
+ if (source == target) {
+ // Shortcut for performance
+ return true;
+ }
+ if (source == null || target == null) {
+ return false;
+ }
+ if (source.isRemotable() != target.isRemotable()) {
+ return false;
+ }
+ if (source.isConversational() != target.isConversational()) {
+ return false;
+ }
+
+ for (Operation operation : source.getOperations()) {
+ Operation targetOperation = getOperation(target.getOperations(), operation.getName());
+ if (targetOperation == null) {
+ return false;
+ }
+ if (!operation.equals(targetOperation)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isCompatible(InterfaceContract source, InterfaceContract target) {
+ try {
+ return checkCompatibility(source, target, false, true);
+ } catch (IncompatibleInterfaceContractException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
+ * org.apache.tuscany.sca.interfacedef.Operation)
+ */
+ public Operation map(Interface target, Operation source) {
+ if (target.isRemotable()) {
+ for (Operation op : target.getOperations()) {
+ if (op.getName().equals(source.getName())) {
+ return op;
+ }
+ }
+ return null;
+ } else {
+ for (Operation op : target.getOperations()) {
+ if (isCompatible(source, op, target.isRemotable())) {
+ return op;
+ }
+ }
+ return null;
+ }
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
new file mode 100644
index 0000000000..77d2c8a6ab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.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.sca.interfacedef.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents a service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InterfaceImpl implements Interface {
+
+ private boolean remotable;
+ private boolean conversational;
+ private OperationList operations = new OperationList();
+ private boolean unresolved;
+
+ public boolean isRemotable() {
+ return remotable;
+ }
+
+ public void setRemotable(boolean local) {
+ this.remotable = local;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ /**
+ * @return the conversational
+ */
+ public boolean isConversational() {
+ return conversational;
+ }
+
+ /**
+ * @param conversational the conversational to set
+ */
+ public void setConversational(boolean conversational) {
+ this.conversational = conversational;
+ }
+
+ private class OperationList extends ArrayList<Operation> {
+ private static final long serialVersionUID = -903469106307606099L;
+
+ @Override
+ public Operation set(int index, Operation element) {
+ element.setInterface(InterfaceImpl.this);
+ return super.set(index, element);
+ }
+
+ @Override
+ public void add(int index, Operation element) {
+ element.setInterface(InterfaceImpl.this);
+ super.add(index, element);
+ }
+
+ @Override
+ public boolean add(Operation o) {
+ o.setInterface(InterfaceImpl.this);
+ return super.add(o);
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Operation> c) {
+ for (Operation op : c) {
+ op.setInterface(InterfaceImpl.this);
+ }
+ return super.addAll(c);
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends Operation> c) {
+ for (Operation op : c) {
+ op.setInterface(InterfaceImpl.this);
+ }
+ return super.addAll(index, c);
+ }
+
+ }
+
+ public void setDefaultDataBinding(String dataBinding) {
+ for (Operation op : getOperations()) {
+ if (op.getDataBinding() == null) {
+ op.setDataBinding(dataBinding);
+ DataType<List<DataType>> inputType = op.getInputType();
+ if (inputType != null) {
+ for (DataType d : inputType.getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ DataType outputType = op.getOutputType();
+ if (outputType != null && outputType.getDataBinding() == null) {
+ outputType.setDataBinding(dataBinding);
+ }
+ List<DataType> faultTypes = op.getFaultTypes();
+ if (faultTypes != null) {
+ for (DataType d : faultTypes) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ if (op.isWrapperStyle()) {
+ WrapperInfo wrapper = op.getWrapper();
+ if (wrapper != null) {
+ DataType<List<DataType>> unwrappedInputType = wrapper.getUnwrappedInputType();
+ if (unwrappedInputType != null) {
+ for (DataType d : unwrappedInputType.getLogical()) {
+ if (d.getDataBinding() == null) {
+ d.setDataBinding(dataBinding);
+ }
+ }
+ }
+ DataType unwrappedOutputType = wrapper.getUnwrappedOutputType();
+ if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
+ unwrappedOutputType.setDataBinding(dataBinding);
+ }
+ }
+ }
+ }
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
new file mode 100644
index 0000000000..064798f36e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
@@ -0,0 +1,285 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
+
+/**
+ * Represents an operation on a service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class OperationImpl implements Operation {
+
+ private String name;
+ private boolean unresolved;
+ private DataType outputType;
+ private DataType<List<DataType>> inputType;
+ private List<DataType> faultTypes;
+ private Interface interfaze;
+ private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
+ private boolean nonBlocking;
+ private boolean wrapperStyle;
+ private WrapperInfo wrapper;
+ private String dataBinding;
+
+ /**
+ * @param name
+ */
+ public OperationImpl() {
+ this(null);
+ }
+
+ /**
+ * @param name
+ */
+ public OperationImpl(String name) {
+ this(name, null, null, null);
+ }
+
+ /**
+ * @param name
+ * @param inputType
+ * @param outputType
+ * @param faultTypes
+ */
+ public OperationImpl(String name, DataType<List<DataType>> inputType, DataType outputType, List<DataType> faultTypes) {
+ super();
+ this.name = name;
+ this.inputType = inputType != null ? inputType : new DataTypeImpl<List<DataType>>("idl:input", Object[].class,
+ new ArrayList<DataType>());
+ this.outputType = outputType;
+ this.faultTypes = faultTypes != null ? faultTypes : new ArrayList<DataType>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean undefined) {
+ this.unresolved = undefined;
+ }
+
+ /**
+ * @return the faultTypes
+ */
+ public List<DataType> getFaultTypes() {
+ return faultTypes;
+ }
+
+ /**
+ * @param faultTypes the faultTypes to set
+ */
+ public void setFaultTypes(List<DataType> faultTypes) {
+ this.faultTypes = faultTypes;
+ }
+
+ /**
+ * @return the inputType
+ */
+ public DataType<List<DataType>> getInputType() {
+ return inputType;
+ }
+
+ /**
+ * @param inputType the inputType to set
+ */
+ public void setInputType(DataType<List<DataType>> inputType) {
+ this.inputType = inputType;
+ }
+
+ /**
+ * @return the outputType
+ */
+ public DataType getOutputType() {
+ return outputType;
+ }
+
+ /**
+ * @param outputType the outputType to set
+ */
+ public void setOutputType(DataType outputType) {
+ this.outputType = outputType;
+ }
+
+ /**
+ * @return the interfaze
+ */
+ public Interface getInterface() {
+ return interfaze;
+ }
+
+ /**
+ * @param interfaze the interfaze to set
+ */
+ public void setInterface(Interface interfaze) {
+ this.interfaze = interfaze;
+ }
+
+ /**
+ * @return the conversationSequence
+ */
+ public ConversationSequence getConversationSequence() {
+ return conversationSequence;
+ }
+
+ /**
+ * @param conversationSequence the conversationSequence to set
+ */
+ public void setConversationSequence(ConversationSequence conversationSequence) {
+ this.conversationSequence = conversationSequence;
+ }
+
+ /**
+ * @return the nonBlocking
+ */
+ public boolean isNonBlocking() {
+ return nonBlocking;
+ }
+
+ /**
+ * @param nonBlocking the nonBlocking to set
+ */
+ public void setNonBlocking(boolean nonBlocking) {
+ this.nonBlocking = nonBlocking;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((conversationSequence == null) ? 0 : conversationSequence.hashCode());
+ // result = PRIME * result + ((faultTypes == null) ? 0 :
+ // faultTypes.hashCode());
+ result = PRIME * result + ((inputType == null) ? 0 : inputType.hashCode());
+ result = PRIME * result + ((name == null) ? 0 : name.hashCode());
+ result = PRIME * result + (nonBlocking ? 1231 : 1237);
+ result = PRIME * result + ((outputType == null) ? 0 : outputType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final OperationImpl other = (OperationImpl)obj;
+ if (conversationSequence == null) {
+ if (other.conversationSequence != null) {
+ return false;
+ }
+ } else if (!conversationSequence.equals(other.conversationSequence)) {
+ return false;
+ }
+ /*
+ * if (faultTypes == null) { if (other.faultTypes != null) { return
+ * false; } } else if (!faultTypes.equals(other.faultTypes)) { return
+ * false; }
+ */
+
+ if (inputType == null) {
+ if (other.inputType != null) {
+ return false;
+ }
+ } else if (!inputType.equals(other.inputType)) {
+ return false;
+ }
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (nonBlocking != other.nonBlocking) {
+ return false;
+ }
+ if (outputType == null) {
+ if (other.outputType != null) {
+ return false;
+ }
+ } else if (!outputType.equals(other.outputType)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return the wrapperInfo
+ */
+ public WrapperInfo getWrapper() {
+ return wrapper;
+ }
+
+ /**
+ * @param wrapperInfo the wrapperInfo to set
+ */
+ public void setWrapper(WrapperInfo wrapperInfo) {
+ this.wrapper = wrapperInfo;
+ }
+
+ /**
+ * @return the wrapperStyle
+ */
+ public boolean isWrapperStyle() {
+ return wrapperStyle;
+ }
+
+ /**
+ * @param wrapperStyle the wrapperStyle to set
+ */
+ public void setWrapperStyle(boolean wrapperStyle) {
+ this.wrapperStyle = wrapperStyle;
+ }
+
+ public String getDataBinding() {
+ return dataBinding;
+ }
+
+ public void setDataBinding(String dataBinding) {
+ this.dataBinding = dataBinding;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java
new file mode 100644
index 0000000000..b1e7857fec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.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.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema elements
+ */
+public class ElementInfo {
+ private final QName name;
+ private final TypeInfo type;
+
+ /**
+ * @param name
+ * @param type
+ */
+ public ElementInfo(QName name, TypeInfo type) {
+ super();
+ this.name = name;
+ this.type = type;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the type
+ */
+ public TypeInfo getType() {
+ return type;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Element: ").append(name).append(" ").append(type);
+ return sb.toString();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java
new file mode 100644
index 0000000000..1775e065aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.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.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The generic java exception to wrap service faults
+ *
+ * @version $Rev$ $Date$
+ */
+public class FaultException extends Exception {
+ private static final long serialVersionUID = -8002583655240625792L;
+ private Object faultInfo;
+ private QName logical;
+
+ /**
+ * @param message
+ * @param faultInfo
+ */
+ public FaultException(String message, Object faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @param message
+ * @param faultInfo
+ * @param cause
+ */
+ public FaultException(String message, Object faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ * @return the faultInfo
+ */
+ public Object getFaultInfo() {
+ return faultInfo;
+ }
+
+ public QName getLogical() {
+ return logical;
+ }
+
+ public void setLogical(QName logical) {
+ this.logical = logical;
+ }
+
+ public boolean isMatchingType(Object type) {
+ if (logical == null) {
+ return false;
+ }
+
+ if ((type instanceof QName) && logical.equals(type)) {
+ return true;
+ }
+ if (type instanceof XMLType && logical.equals(((XMLType)type).getElementName())) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
new file mode 100644
index 0000000000..5efa8ab15f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.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.sca.interfacedef.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+public final class JavaXMLMapper {
+ public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+ private static final Map<Class, QName> JAVA2XML = new HashMap<Class, QName>();
+ private static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
+
+ private JavaXMLMapper() {
+ }
+
+ static {
+ JAVA2XML.put(boolean.class, getTypeName("boolean"));
+ JAVA2XML.put(byte.class, getTypeName("byte"));
+ JAVA2XML.put(short.class, getTypeName("short"));
+ JAVA2XML.put(int.class, getTypeName("int"));
+ JAVA2XML.put(long.class, getTypeName("long"));
+ JAVA2XML.put(float.class, getTypeName("float"));
+ JAVA2XML.put(double.class, getTypeName("double"));
+ JAVA2XML.put(Boolean.class, getTypeName("boolean"));
+ JAVA2XML.put(Byte.class, getTypeName("byte"));
+ JAVA2XML.put(Short.class, getTypeName("short"));
+ JAVA2XML.put(Integer.class, getTypeName("int"));
+ JAVA2XML.put(Long.class, getTypeName("long"));
+ JAVA2XML.put(Float.class, getTypeName("float"));
+ JAVA2XML.put(Double.class, getTypeName("double"));
+ JAVA2XML.put(java.lang.String.class, getTypeName("string"));
+ JAVA2XML.put(java.math.BigInteger.class, getTypeName("integer"));
+ JAVA2XML.put(java.math.BigDecimal.class, getTypeName("decimal"));
+ JAVA2XML.put(java.util.Calendar.class, getTypeName("dateTime"));
+ JAVA2XML.put(java.util.Date.class, getTypeName("dateTime"));
+ JAVA2XML.put(javax.xml.namespace.QName.class, getTypeName("QName"));
+ JAVA2XML.put(java.net.URI.class, getTypeName("string"));
+ JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, getTypeName("anySimpleType"));
+ JAVA2XML.put(javax.xml.datatype.Duration.class, getTypeName("duration"));
+ JAVA2XML.put(java.lang.Object.class, getTypeName("anyType"));
+ JAVA2XML.put(java.awt.Image.class, getTypeName("base64Binary"));
+ JAVA2XML.put(byte[].class, getTypeName("base64Binary"));
+ // java2XSD.put(javax.activation.DataHandler.class, getTypeName("base64Binary"));
+ JAVA2XML.put(javax.xml.transform.Source.class, getTypeName("base64Binary"));
+ JAVA2XML.put(java.util.UUID.class, getTypeName("string"));
+ }
+
+ static {
+ XML2JAVA.put("string", java.lang.String.class);
+ XML2JAVA.put("integer", java.math.BigInteger.class);
+ XML2JAVA.put("int", int.class);
+ XML2JAVA.put("long", long.class);
+ XML2JAVA.put("short", short.class);
+ XML2JAVA.put("decimal", java.math.BigDecimal.class);
+ XML2JAVA.put("float", float.class);
+ XML2JAVA.put("double", double.class);
+ XML2JAVA.put("boolean", boolean.class);
+ XML2JAVA.put("byte", byte.class);
+ XML2JAVA.put("QName", javax.xml.namespace.QName.class);
+ XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("base64Binary", byte[].class);
+ XML2JAVA.put("hexBinary", byte[].class);
+ XML2JAVA.put("unsignedInt", long.class);
+ XML2JAVA.put("unsignedShort", int.class);
+ XML2JAVA.put("unsignedByte", short.class);
+ XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class);
+ XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements
+ // XML2JAVA.put("anySimpleType", java.lang.String.class); // For
+ // attributes
+ XML2JAVA.put("duration", javax.xml.datatype.Duration.class);
+ XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class);
+ }
+
+ public static Class getJavaType(QName xmlType) {
+ if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
+ return XML2JAVA.get(xmlType.getLocalPart());
+ } else {
+ return null;
+ }
+ }
+
+ private static QName getTypeName(String name) {
+ return new QName(URI_2001_SCHEMA_XSD, name);
+ }
+
+ public static QName getXMLType(Class javaType) {
+ return JAVA2XML.get(javaType);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java
new file mode 100644
index 0000000000..348c8cffd8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.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.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An abstraction of XML schema types
+ */
+public class TypeInfo {
+ private QName name;
+
+ private boolean isSimpleType;
+
+ private TypeInfo baseType;
+
+ /**
+ * @param name
+ * @param isSimpleType
+ */
+ public TypeInfo(QName name, boolean isSimpleType, TypeInfo baseType) {
+ super();
+ this.name = name;
+ this.isSimpleType = isSimpleType;
+ this.baseType = baseType;
+ }
+
+ /**
+ * @return the isSimpleType
+ */
+ public boolean isSimpleType() {
+ return isSimpleType;
+ }
+
+ /**
+ * @return the name
+ */
+ public QName getQName() {
+ return name;
+ }
+
+ /**
+ * @return the baseType
+ */
+ public TypeInfo getBaseType() {
+ return baseType;
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Type: ").append(name);
+ return sb.toString();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
new file mode 100644
index 0000000000..73aa244bbd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+
+/**
+ * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based
+ * Web Services (JAX-WS) 2.0 specification, section 2.3.1.2 Wrapper Style. <p/>
+ * A WSDL operation qualifies for wrapper style mapping only if the following
+ * criteria are met:
+ * <ul>
+ * <li>(i) The operation�s input and output messages (if present) each contain
+ * only a single part
+ * <li>(ii) The input message part refers to a global element declaration whose
+ * localname is equal to the operation name
+ * <li>(iii) The output message part refers to a global element declaration
+ * <li>(iv) The elements referred to by the input and output message parts
+ * (henceforth referred to as wrapper elements) are both complex types defined
+ * using the xsd:sequence compositor
+ * <li>(v) The wrapper elements only contain child elements, they must not
+ * contain other structures such as wildcards (element or attribute),
+ * xsd:choice, substitution groups (element references are not permitted) or
+ * attributes; furthermore, they must not be nillable.
+ * </ul>
+ *
+ * @version $Rev$ $Date$
+ */
+public class WrapperInfo {
+ private ElementInfo inputWrapperElement;
+
+ private ElementInfo outputWrapperElement;
+
+ private List<ElementInfo> inputChildElements;
+
+ private List<ElementInfo> outputChildElements;
+
+ private DataType<List<DataType>> unwrappedInputType;
+
+ private DataType<XMLType> unwrappedOutputType;
+
+ private String dataBinding;
+
+ public WrapperInfo(String dataBinding,
+ ElementInfo inputWrapperElement,
+ ElementInfo outputWrapperElement,
+ List<ElementInfo> inputElements,
+ List<ElementInfo> outputElements) {
+ super();
+ this.dataBinding = dataBinding;
+ this.inputWrapperElement = inputWrapperElement;
+ this.outputWrapperElement = outputWrapperElement;
+ this.inputChildElements = inputElements;
+ this.outputChildElements = outputElements;
+ }
+
+ /**
+ * @return the inputElements
+ */
+ public List<ElementInfo> getInputChildElements() {
+ return inputChildElements;
+ }
+
+ /**
+ * @return the inputWrapperElement
+ */
+ public ElementInfo getInputWrapperElement() {
+ return inputWrapperElement;
+ }
+
+ /**
+ * @return the outputElements
+ */
+ public List<ElementInfo> getOutputChildElements() {
+ return outputChildElements;
+ }
+
+ /**
+ * @return the outputWrapperElement
+ */
+ public ElementInfo getOutputWrapperElement() {
+ return outputWrapperElement;
+ }
+
+ /**
+ * @return the unwrappedInputType
+ */
+ public DataType<List<DataType>> getUnwrappedInputType() {
+ if (unwrappedInputType == null) {
+ List<DataType> childTypes = new ArrayList<DataType>();
+ for (ElementInfo element : getInputChildElements()) {
+ DataType<XMLType> type = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ childTypes.add(type);
+ }
+ unwrappedInputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class,
+ childTypes);
+ }
+ return unwrappedInputType;
+ }
+
+ /**
+ * @return the unwrappedOutputType
+ */
+ public DataType getUnwrappedOutputType() {
+ if (unwrappedOutputType == null) {
+ List<ElementInfo> elements = getOutputChildElements();
+ if (elements != null && elements.size() > 0) {
+ if (elements.size() > 1) {
+ // We don't support output with multiple parts
+ throw new IllegalArgumentException("Multi-part output is not supported");
+ }
+ ElementInfo element = elements.get(0);
+
+ unwrappedOutputType = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
+ }
+ }
+ return unwrappedOutputType;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
new file mode 100644
index 0000000000..aeafe15df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.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.sca.interfacedef.util;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The metadata for an XML element or type
+ */
+public class XMLType {
+ public static final XMLType UNKNOWN = new XMLType(null, null);
+ protected QName element;
+ protected QName type;
+
+ /**
+ * @param element
+ */
+ public XMLType(ElementInfo element) {
+ super();
+ this.element = element.getQName();
+ if (element.getType() != null) {
+ this.type = element.getType().getQName();
+ }
+ }
+
+ /**
+ * @param element
+ */
+ public XMLType(TypeInfo type) {
+ this.element = null;
+ this.type = type.getQName();
+ }
+
+ public XMLType(QName element, QName type) {
+ this.element = element;
+ this.type = type;
+ }
+
+ /**
+ * @return the type
+ */
+ public QName getTypeName() {
+ return type;
+ }
+
+ public boolean isElement() {
+ return element != null;
+ }
+
+ public QName getElementName() {
+ return element;
+ }
+
+ public static XMLType getType(QName type) {
+ return new XMLType(null, type);
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + ((element == null) ? 0 : element.hashCode());
+ result = PRIME * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final XMLType other = (XMLType)obj;
+ if (element == null) {
+ if (other.element != null) {
+ return false;
+ }
+ } else if (!element.equals(other.element)) {
+ return false;
+ }
+ if (type == null) {
+ if (other.type != null) {
+ return false;
+ }
+ } else if (!type.equals(other.type)) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "Element: " + element + " Type: " + type;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
new file mode 100644
index 0000000000..424d9327ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
@@ -0,0 +1,366 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.interfacedef.impl;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
+import org.apache.tuscany.sca.interfacedef.Interface;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * TODO some tests commented out due to DataType.equals() needing to be strict
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContractCompatibilityTestCase extends TestCase {
+
+ private InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
+
+ public void testNoOperation() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ InterfaceContract target = new MockContract("FooContract");
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testBasic() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ Operation opSource1 = new OperationImpl("op1");
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opSource2 = new OperationImpl("op1");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opSource2);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testBasicIncompatibleOperationNames() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ Operation opSource1 = new OperationImpl("op1");
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opSource2 = new OperationImpl("op2");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op2", opSource2);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ public void testInputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ sourceInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setInputType(inputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ List<DataType> targetInputTypes = new ArrayList<DataType>();
+ targetInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
+ DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+
+ Operation opTarget = new OperationImpl("op1");
+ opTarget.setInputType(targetInputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testIncompatibleInputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ sourceInputTypes.add(new DataTypeImpl<Type>(Integer.class, Integer.class));
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setInputType(inputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ List<DataType> targetInputTypes = new ArrayList<DataType>();
+ targetInputTypes.add(new DataTypeImpl<Type>(String.class, String.class));
+ DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+
+ Operation opTarget = new OperationImpl("op1");
+ opTarget.setInputType(targetInputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ /**
+ * Verfies source input types can be super types of the target
+ */
+ public void testSourceSuperTypeInputCompatibility() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // List<DataType> sourceInputTypes = new ArrayList<DataType>();
+ // sourceInputTypes.add(new DataTypeImpl<Type>(Object.class,
+ // Object.class));
+ // DataType<List<DataType>> inputType = new
+ // DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
+ // Operation opSource1 = new OperationImpl("op1", inputType, null, null,
+ // false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // List<DataType> targetInputTypes = new ArrayList<DataType>();
+ // targetInputTypes.add(new DataTypeImpl<Type>(String.class,
+ // String.class));
+ // DataType<List<DataType>> targetInputType =
+ // new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
+ //
+ // Operation opTarget = new OperationImpl("op1", targetInputType, null,
+ // null, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testOutputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setOutputType(sourceOutputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opTarget = new OperationImpl("op1");
+ opTarget.setOutputType(targetOutputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ /**
+ * Verfies a return type that is a supertype of of the target is compatible
+ */
+ public void testSupertypeOutputTypes() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceOutputType = new DataTypeImpl<Type>(Object.class,
+ // Object.class);
+ // Operation opSource1 = new OperationImpl("op1", null,
+ // sourceOutputType, null, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetOutputType = new DataTypeImpl<Type>(String.class,
+ // String.class);
+ // Operation opTarget = new OperationImpl("op1", null, targetOutputType,
+ // null, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ public void testIncompatibleOutputTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setOutputType(sourceOutputType);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetOutputType = new DataTypeImpl<Type>(Integer.class, Integer.class);
+ Operation opTarget = new OperationImpl("op1");
+ opTarget.setOutputType(targetOutputType);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ try {
+ mapper.checkCompatibility(source, target, false, false);
+ fail();
+ } catch (IncompatibleInterfaceContractException e) {
+ // expected
+ }
+ }
+
+ public void testFaultTypes() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setFaultTypes(sourceFaultTypes);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ DataType targetFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ targetFaultTypes.add(0, targetFaultType);
+
+ Operation opTarget = new OperationImpl("op1");
+ opTarget.setFaultTypes(targetFaultTypes);
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
+ InterfaceContract source = new MockContract("FooContract");
+ DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
+ List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ sourceFaultTypes.add(0, sourceFaultType);
+ Operation opSource1 = new OperationImpl("op1");
+ opSource1.setFaultTypes(sourceFaultTypes);
+ Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
+ sourceOperations.put("op1", opSource1);
+ source.getInterface().getOperations().addAll(sourceOperations.values());
+
+ InterfaceContract target = new MockContract("FooContract");
+ Operation opTarget = new OperationImpl("op1");
+ Map<String, Operation> targetOperations = new HashMap<String, Operation>();
+ targetOperations.put("op1", opTarget);
+ target.getInterface().getOperations().addAll(targetOperations.values());
+ mapper.checkCompatibility(source, target, false, false);
+ }
+
+ /**
+ * Verifies a source's fault which is a supertype of the target's fault are
+ * compatibile
+ *
+ * @throws Exception
+ */
+ public void testFaultSuperTypes() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
+ // Exception.class);
+ // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ // sourceFaultTypes.add(0, sourceFaultType);
+ // Operation opSource1 = new OperationImpl("op1", null, null,
+ // sourceFaultTypes, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetFaultType = new
+ // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
+ // List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ // targetFaultTypes.add(0, targetFaultType);
+ //
+ // Operation opTarget = new OperationImpl("op1", null, null,
+ // targetFaultTypes, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ /**
+ * Verifies a source's faults which are supertypes and a superset of the
+ * target's faults are compatibile
+ */
+ public void testFaultSuperTypesAndSuperset() throws Exception {
+ // InterfaceContract source = new MockContract("FooContract");
+ // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
+ // Exception.class);
+ // DataType sourceFaultType2 = new
+ // DataTypeImpl<Type>(RuntimeException.class, RuntimeException.class);
+ // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
+ // sourceFaultTypes.add(0, sourceFaultType);
+ // sourceFaultTypes.add(1, sourceFaultType2);
+ // Operation opSource1 = new OperationImpl("op1", null, null,
+ // sourceFaultTypes, false, null);
+ // Map<String, Operation> sourceOperations = new HashMap<String,
+ // Operation>();
+ // sourceOperations.put("op1", opSource1);
+ // source.getInterface().getOperations().addAll(sourceOperations.values());
+ //
+ // InterfaceContract target = new MockContract("FooContract");
+ // DataType targetFaultType = new
+ // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
+ // List<DataType> targetFaultTypes = new ArrayList<DataType>();
+ // targetFaultTypes.add(0, targetFaultType);
+ //
+ // Operation opTarget = new OperationImpl("op1", null, null,
+ // targetFaultTypes, false, null);
+ // Map<String, Operation> targetOperations = new HashMap<String,
+ // Operation>();
+ // targetOperations.put("op1", opTarget);
+ // target.getInterface().getOperations().addAll(targetOperations.values());
+ // wireService.checkCompatibility(source, target, false);
+ }
+
+ private static class MockInterface extends InterfaceImpl {
+
+ }
+
+ private class MockContract<T> extends InterfaceContractImpl {
+ public MockContract() {
+ }
+
+ public MockContract(String interfaceClass) {
+ Interface jInterface = new MockInterface();
+ jInterface.setUnresolved(true);
+ setInterface(jInterface);
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/pom.xml
new file mode 100644
index 0000000000..df2fe09e5a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/pom.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <name>Apache Tuscany Axis2 Java2WSDL Tool</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/CreditScoreDocLit.wsdl</schemaFile>
+ <javaPackage>org.example.creditscore.doclit</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <!-- <id>eclipse.emf</id>
+ <url>http://download.eclipse.org/tools/emf/maven2</url> -->
+ <!-- <id>osuosl.org</id>
+ <url>http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2</url> -->
+ <!-- temporarily using indiana state univ as eclipse site diesnt have 2.2.2 at the moment -->
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java
new file mode 100644
index 0000000000..3cb699681c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/GenerationParameters.java
@@ -0,0 +1,435 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.ws.java2wsdl.Java2WSDLUtils;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+
+/**
+ * This class encapsulates the parameters that effect the generation of the
+ * WSDL. For example they contain all user settings such as source class,
+ * target location etc.
+ *
+ */
+public class GenerationParameters implements TuscanyJava2WSDLConstants
+{
+ public static final String WSDL_FILENAME_SUFFIX = ".wsdl";
+ public static final String XSD_IMPORT_DELIMITER = "[,]";
+
+ private Map cmdLineOptions = null;
+ private FileOutputStream outputFileStream = null;
+ private String sourceClassName = null;
+
+ private ArrayList extraClasses;
+ private String attrFormDefault = null;
+ private String elementFormDefault = null;
+ private String targetNamespace = null;
+ private String targetNamespacePrefix = null;
+ private String schemaTargetNamespace = null;
+ private String schemaTargetNamespacePrefix = null;
+ private ClassLoader classLoader = null;
+ private String serviceName = null;
+ private String style = DOCUMENT;
+ private String use = LITERAL;
+ private String locationUri = DEFAULT_LOCATION_URL;
+ private Map schemaLocationMap = null;
+
+ public GenerationParameters(Map cmdLineOptions) throws Exception
+ {
+ this.cmdLineOptions = cmdLineOptions;
+ loadParameters();
+ }
+
+ protected void loadParameters() throws Exception
+ {
+ initializeSourceClassName();
+ resolveFileOutputStream();
+ resolveClassLoader4InputClasspath();
+ loadSchemaLocationMap();
+ initializeOtherParams();
+ }
+
+ private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption) {
+ //short option gets precedence
+ Java2WSDLCommandLineOption option = null;
+ if (longOption != null) {
+ option = (Java2WSDLCommandLineOption) cmdLineOptions.get(longOption);
+ if (option != null) {
+ return option;
+ }
+ }
+ if (shortOption != null) {
+ option = (Java2WSDLCommandLineOption) cmdLineOptions.get(shortOption);
+ }
+
+ return option;
+ }
+
+ protected void initializeSourceClassName() throws Exception
+ {
+ Java2WSDLCommandLineOption option =
+ loadOption(CLASSNAME_OPTION, CLASSNAME_OPTION_LONG);
+ sourceClassName = option == null ? null : option.getOptionValue();
+
+ if (sourceClassName == null || sourceClassName.equals("")) {
+ throw new Exception("class name must be present!");
+ }
+ }
+
+ /**
+ * @throws Exception
+ */
+ protected void resolveFileOutputStream() throws Exception
+ {
+ File outputFolder;
+ Java2WSDLCommandLineOption option = loadOption(OUTPUT_LOCATION_OPTION,
+ OUTPUT_LOCATION_OPTION_LONG);
+ String outputFolderName = option == null ? System.getProperty("user.dir") : option.getOptionValue();
+
+ outputFolder = new File(outputFolderName);
+ if (!outputFolder.exists()) {
+ outputFolder.mkdirs();
+ } else if (!outputFolder.isDirectory()) {
+ throw new Exception("The specified location " + outputFolderName + "is not a folder");
+ }
+
+ option = loadOption(OUTPUT_FILENAME_OPTION,
+ OUTPUT_FILENAME_OPTION_LONG);
+ String outputFileName = option == null ? null : option.getOptionValue();
+ //derive a file name from the class name if the filename is not specified
+ if (outputFileName == null)
+ {
+ outputFileName = Java2WSDLUtils.getSimpleClassName(sourceClassName) + WSDL_FILENAME_SUFFIX;
+ }
+
+ //first create a file in the given location
+ File outputFile = new File(outputFolder, outputFileName);
+ try
+ {
+ if (!outputFile.exists())
+ {
+ outputFile.createNewFile();
+ }
+ outputFileStream = new FileOutputStream(outputFile);
+ }
+ catch (IOException e)
+ {
+ throw new Exception(e);
+ }
+ }
+
+ protected void addToSchemaLocationMap(String optionValue) throws Exception
+ {
+ //option value will be of the form [namespace, schemalocation]
+ //hence we take the two substrings starting after '[' and upto ',' and
+ //starting after ',' and upto ']'
+ getSchemaLocationMap().put(optionValue.substring(1, optionValue.indexOf(COMMA)),
+ optionValue.substring(optionValue.indexOf(COMMA) + 1, optionValue.length() - 1));
+
+
+ }
+
+ protected void loadSchemaLocationMap() throws Exception
+ {
+ Java2WSDLCommandLineOption option = loadOption(IMPORT_XSD_OPTION, IMPORT_XSD_OPTION_LONG);
+
+ if (option != null)
+ {
+ ArrayList optionValues = option.getOptionValues();
+
+ for ( int count = 0 ; count < optionValues.size() ; ++count )
+ {
+ addToSchemaLocationMap(((String)optionValues.get(count)).trim());
+ }
+ }
+ }
+
+ protected void resolveClassLoader4InputClasspath() throws Exception
+ {
+ Java2WSDLCommandLineOption option =
+ loadOption(CLASSPATH_OPTION, CLASSPATH_OPTION_LONG);
+
+ if (option != null) {
+ ArrayList optionValues = option.getOptionValues();
+ URL[] urls = new URL[optionValues.size()];
+ String[] classPathEntries = (String[]) optionValues.toArray(new String[optionValues.size()]);
+
+ try {
+ for (int i = 0; i < classPathEntries.length; i++) {
+ String classPathEntry = classPathEntries[i];
+ //this should be a file(or a URL)
+ if (Java2WSDLUtils.isURL(classPathEntry)) {
+ urls[i] = new URL(classPathEntry);
+ } else {
+ urls[i] = new File(classPathEntry).toURL();
+ }
+ }
+ } catch (MalformedURLException e) {
+ throw new Exception(e);
+ }
+
+ classLoader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader());
+
+ } else {
+ classLoader = Thread.currentThread().getContextClassLoader();
+ }
+ }
+
+ protected void initializeOtherParams()
+ {
+// set the other parameters to the builder
+ Java2WSDLCommandLineOption option = loadOption(SCHEMA_TARGET_NAMESPACE_OPTION,
+ SCHEMA_TARGET_NAMESPACE_OPTION_LONG);
+ schemaTargetNamespace = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION,
+ SCHEMA_TARGET_NAMESPACE_PREFIX_OPTION_LONG);
+ schemaTargetNamespacePrefix = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(TARGET_NAMESPACE_OPTION,
+ TARGET_NAMESPACE_OPTION_LONG);
+ targetNamespace = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(TARGET_NAMESPACE_PREFIX_OPTION,
+ TARGET_NAMESPACE_PREFIX_OPTION_LONG);
+ targetNamespacePrefix = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(SERVICE_NAME_OPTION,
+ SERVICE_NAME_OPTION_LONG);
+ serviceName = (option == null) ? Java2WSDLUtils.getSimpleClassName(sourceClassName) : option.getOptionValue();
+
+ option = loadOption(STYLE_OPTION,STYLE_OPTION);
+ style = (option == null) ? null : option.getOptionValue();
+
+
+ option = loadOption(LOCATION_OPTION,
+ LOCATION_OPTION);
+ locationUri = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(USE_OPTION,USE_OPTION);
+ use = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(ATTR_FORM_DEFAULT_OPTION, ATTR_FORM_DEFAULT_OPTION_LONG);
+ attrFormDefault = (option == null) ? null : option.getOptionValue();
+
+ option = loadOption(ELEMENT_FORM_DEFAULT_OPTION,ELEMENT_FORM_DEFAULT_OPTION_LONG);
+ elementFormDefault = option == null ? null : option.getOptionValue();
+
+ option = loadOption(TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION,
+ TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG);
+ extraClasses = option == null ? new ArrayList() : option.getOptionValues();
+ }
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ public String getLocationUri()
+ {
+ if ( locationUri == null )
+ {
+ locationUri = DEFAULT_LOCATION_URL;
+ }
+ return locationUri;
+ }
+
+ public void setLocationUri(String locationUri)
+ {
+ this.locationUri = locationUri;
+ }
+
+ public FileOutputStream getOutputFileStream()
+ {
+ return outputFileStream;
+ }
+
+ public void setOutputFileStream(FileOutputStream outputFileStream)
+ {
+ this.outputFileStream = outputFileStream;
+ }
+
+ public String getSchemaTargetNamespace() throws Exception
+ {
+ if (schemaTargetNamespace == null
+ || schemaTargetNamespace.trim().equals(""))
+ {
+ this.schemaTargetNamespace = Java2WSDLUtils
+ .schemaNamespaceFromClassName(getSourceClassName(), getClassLoader()).toString();
+ }
+ return schemaTargetNamespace;
+ }
+
+ public void setSchemaTargetNamespace(String schemaTargetNamespace)
+ {
+ this.schemaTargetNamespace = schemaTargetNamespace;
+ }
+
+ public String getSchemaTargetNamespacePrefix()
+ {
+ if (schemaTargetNamespacePrefix == null
+ || schemaTargetNamespacePrefix.trim().equals(""))
+ {
+ this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX;
+ }
+
+ return schemaTargetNamespacePrefix;
+ }
+
+ public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix)
+ {
+ this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
+ }
+
+ public String getServiceName()
+ {
+ if ( serviceName == null )
+ {
+ serviceName = Java2WSDLUtils.getSimpleClassName(getSourceClassName());
+ }
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public String getSourceClassName()
+ {
+ return sourceClassName;
+ }
+
+ public void setSourceClassName(String sourceClassName)
+ {
+ this.sourceClassName = sourceClassName;
+ }
+
+ public String getStyle()
+ {
+ if ( style == null )
+ {
+ style = DOCUMENT;
+ }
+ return style;
+ }
+
+ public void setStyle(String style)
+ {
+ this.style = style;
+ }
+
+ public String getTargetNamespace() throws Exception
+ {
+ if ( targetNamespace == null ) {
+ targetNamespace = Java2WSDLUtils.namespaceFromClassName(this.sourceClassName, this.classLoader).toString();
+ }
+ return targetNamespace;
+ }
+
+ public void setTargetNamespace(String targetNamespace)
+ {
+ this.targetNamespace = targetNamespace;
+ }
+
+ public String getTargetNamespacePrefix()
+ {
+ return targetNamespacePrefix;
+ }
+
+ public void setTargetNamespacePrefix(String targetNamespacePrefix)
+ {
+ this.targetNamespacePrefix = targetNamespacePrefix;
+ }
+
+ public String getUse()
+ {
+ if ( use == null )
+ {
+ use = LITERAL;
+ }
+ return use;
+ }
+
+ public void setUse(String use)
+ {
+ this.use = use;
+ }
+
+ public Map getSchemaLocationMap()
+ {
+ if ( schemaLocationMap == null )
+ {
+ schemaLocationMap = new Hashtable();
+ }
+ return schemaLocationMap;
+ }
+
+ public void setSchemaLocationMap(Map schemaLocationMap) {
+ this.schemaLocationMap = schemaLocationMap;
+ }
+
+ public String getAttrFormDefault() {
+ if ( attrFormDefault == null )
+ {
+ attrFormDefault = FORM_DEFAULT_QUALIFIED;
+ }
+ return attrFormDefault;
+ }
+
+ public void setAttrFormDefault(String attrFormDefault) {
+ this.attrFormDefault = attrFormDefault;
+ }
+
+ public String getElementFormDefault() {
+ if ( elementFormDefault == null )
+ {
+ elementFormDefault = FORM_DEFAULT_QUALIFIED;
+ }
+ return elementFormDefault;
+ }
+
+ public void setElementFormDefault(String elementFormDefault) {
+ this.elementFormDefault = elementFormDefault;
+ }
+
+ public ArrayList getExtraClasses() {
+ return extraClasses;
+ }
+
+ public void setExtraClasses(ArrayList extraClasses) {
+ this.extraClasses = extraClasses;
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.java
new file mode 100644
index 0000000000..8855c3f6e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDL.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.tools.java2wsdl.generate;
+
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser;
+
+/**
+ * This class provides the tooling abstraction to Tuscany Java2WSDL and can be
+ * invoked from command line with the follwing options as with Axis2 Java2WSDL
+ *
+ */
+public class Java2WSDL {
+ /**
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ //parse the cmd line args
+ Java2WSDLCommandLineOptionParser commandLineOptionParser =
+ new Java2WSDLCommandLineOptionParser(args);
+ // validate the arguments
+ validateCommandLineOptions(commandLineOptionParser);
+
+ Java2WSDLGeneratorFactory.getInstance().createGenerator().
+ generateWSDL(commandLineOptionParser.getAllOptions());
+
+ // Uncomment the following statement to directly run the Axis2 tool
+ // without
+ // runAxis2Tool(args);
+ }
+
+ private static void runAxis2Tool(String[] args) {
+ org.apache.ws.java2wsdl.Java2WSDL.main(args);
+ }
+
+ private static void validateCommandLineOptions(Java2WSDLCommandLineOptionParser parser) {
+ if (parser.getAllOptions().size() == 0) {
+ printUsage();
+ } else if (parser.getInvalidOptions(new TuscanyJava2WSDLOptionsValidator()).size() > 0) {
+ printUsage();
+ }
+
+ }
+
+ public static void printUsage() {
+ System.out.println("Usage java2wsdl -cn <fully qualified class name> : class file name");
+ System.out.println("-o <output Location> : output file location");
+ System.out.println("-cp <class path uri> : list of classpath entries - (urls)");
+ System.out.println("-tn <target namespace> : target namespace");
+ System.out.println("-tp <target namespace prefix> : target namespace prefix");
+ System.out.println("-stn <schema target namespace> : target namespace for schema");
+ System.out.println("-stp <schema target namespace prefix> : target namespace prefix for schema");
+ System.out.println("-sn <service name> : service name");
+ System.out.println("-of <output file name> : output file name for the WSDL");
+ System.out.println("-st <binding style> : style for the WSDL");
+ System.out.println("-u <binding use> : use for the WSDL");
+ System.out.println("-l <soap address> : address of the port for the WSDL");
+ System.out.println("-ixsd [<schema namespace>, <schema location>] : schemas to be imported (and not generated)");
+ System.out.println("-efd <unqualified> : Setting for elementFormDefault (defaults to qualified)");
+ System.out.println("-afd <unqualified> : Setting for attributeFormDefault (defaults to qualified)");
+ System.out.println("-xc <extra class> : Extra class for which schematype must be generated. " +
+ "\t\tUse as : -xc class1 -xc class2 ...");
+ System.exit(0);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.java
new file mode 100644
index 0000000000..3323113af4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGenerator.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.tools.java2wsdl.generate;
+
+import java.io.OutputStream;
+import java.util.Map;
+
+/**
+ * This is the Java2WSDL Generator facade that will be used by Tuscany
+ * components for java to wsdl conversion.
+ *
+ */
+public interface Java2WSDLGenerator {
+ public void generateWSDL(String[] args);
+
+ public void generateWSDL(Map commandLineOptions);
+
+ public void addWSDLGenListener(WSDLGenListener l);
+
+ public void removeWSDLGenListener(WSDLGenListener l);
+
+ public Map getCommandLineOptions();
+
+ public void setCommandLineOptoins(Map cmdLineOpts);
+
+ public OutputStream getOutputStream();
+
+ public void setOutputStream(OutputStream outStream);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.java
new file mode 100644
index 0000000000..e8f3db95b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorFactory.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.tools.java2wsdl.generate;
+
+import java.util.Vector;
+
+/**
+ * Factory that creates Java2WSDL Generators. Presently the there is a Default
+ * Generator that wraps around the AXIS2 Java2WSDL implementation. The factory
+ * can be extended to create generators that wrap around other implementations
+ * if required.
+ */
+
+public class Java2WSDLGeneratorFactory {
+ /*
+ * singleton instance of this factory class
+ */
+ private static Java2WSDLGeneratorFactory factory = null;
+
+ /**
+ * code for the default generator
+ */
+ public static final int DEFAULT_GENERATOR = 0;
+
+ /**
+ * Default Generator class name
+ */
+ public static final String DEFAULT_GENERATOR_CLASSNAME = "org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorImpl";
+
+ /**
+ * list of generator classnames in a position that corresponds to their
+ * code. For example the default generator's code is 0 and hence this
+ * generator's classname is stored at index '0' of the list
+ */
+ protected Vector<String> generatorClassNames = new Vector<String>();
+
+ /**
+ * @return the singleton instance of this generator factory
+ */
+ public static Java2WSDLGeneratorFactory getInstance() {
+ if (factory == null) {
+ factory = new Java2WSDLGeneratorFactory();
+ }
+ return factory;
+ }
+
+ private Java2WSDLGeneratorFactory() {
+ generatorClassNames.addElement(DEFAULT_GENERATOR_CLASSNAME);
+ }
+
+ public Java2WSDLGenerator createGenerator() {
+ return createGenerator(DEFAULT_GENERATOR);
+ }
+
+ /**
+ * creates an instance of a Java2WSDL Generator based on the input type
+ *
+ * @param genType
+ * type of the generator to be created
+ * @return an instance of a Java2WSDL Generator
+ */
+ public Java2WSDLGenerator createGenerator(int genType) {
+ try {
+ return (Java2WSDLGenerator) (Class.forName(generatorClassNames
+ .elementAt(genType)).newInstance());
+ } catch (Exception e) {
+ System.out
+ .println(" Unable to create Java2WSDL generator due to .....");
+ System.out.println(e);
+ return null;
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java
new file mode 100644
index 0000000000..0ba21f5147
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/Java2WSDLGeneratorImpl.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.ws.java2wsdl.Java2WSDL;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser;
+import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator;
+
+/**
+ * This is an implementation of the Java2WSDLGenerator facade. This
+ * implementation is a decorator around the Axis2 implementation of the
+ * Java2WSDL conversion. The WSDL generation is divided into phases that are
+ * stringed up as a template method. The phases are - User Input Validation -
+ * WSDL Java Model Generation - Serialization of WSDL Java Model The function of
+ * each phase is accomplished by delegation to the appropriate classes in Axis2.
+ * At the start and end of each phase an event is published to subcribers
+ * denoting the start and end of the phase.
+ *
+ * Such a spliting up of the Java2WSDL conversion into phases has been designed
+ * to enable interceptors to modify the model or apply transformations to the
+ * output. Typically the interceptors can subscribe to the start and end events
+ * of these phases and hence be able to intercept.
+ *
+ * Note: This class contains substantial AXIS2 Java2WSDL code refactored into
+ * it. These will be removed as and when the Axis2 code is fixed.
+ *
+ */
+public class Java2WSDLGeneratorImpl implements Java2WSDLGenerator, TuscanyJava2WSDLConstants
+{
+ private List<WSDLGenListener> genPhaseListeners = new Vector<WSDLGenListener>();
+ private GenerationParameters genParams = null;
+ private Map<String, Java2WSDLCommandLineOption> commandLineOptions = null;
+ private TuscanyJava2WSDLBuilder java2WsdlBuilder;
+ private OutputStream outputStream = null;
+
+ public Java2WSDLGeneratorImpl()
+ {
+
+ }
+
+ private void multicastGenPhaseCompletionEvent(int genPhase) {
+ WSDLGenEvent event = new WSDLGenEvent(this, genPhase);
+ Iterator iterator = genPhaseListeners.iterator();
+ while (iterator.hasNext()) {
+ ((WSDLGenListener) iterator.next()).WSDLGenPhaseCompleted(event);
+ }
+ }
+
+ private void initJava2WSDLBuilder() throws Exception
+ {
+// Now we are done with loading the basic values - time to create the builder
+ java2WsdlBuilder = new TuscanyJava2WSDLBuilder(genParams);
+ }
+
+ protected boolean validateInputArgs(String[] args)
+ {
+ boolean isValid = true;
+ Java2WSDLCommandLineOptionParser parser = new Java2WSDLCommandLineOptionParser(args);
+ if (parser.getAllOptions().size() == 0) {
+ Java2WSDL.printUsage();
+ isValid = false;
+ } else if (parser.getInvalidOptions(new Java2WSDLOptionsValidator())
+ .size() > 0) {
+ Java2WSDL.printUsage();
+ isValid = false;
+ }
+
+ if (isValid)
+ {
+ commandLineOptions = parser.getAllOptions();
+ }
+
+ return isValid;
+ }
+
+ public boolean buildWSDLDocument() throws Exception
+ {
+ boolean isComplete = true;
+ initJava2WSDLBuilder();
+ java2WsdlBuilder.buildWSDL();
+
+ return isComplete;
+ }
+
+ public boolean serializeWSDLDocument() throws Exception {
+ boolean isComplete = true;
+
+ if ( getOutputStream() == null )
+ {
+ setOutputStream(genParams.getOutputFileStream());
+ }
+
+ java2WsdlBuilder.getWsdlDocument().serialize(getOutputStream());
+ getOutputStream().flush();
+ getOutputStream().close();;
+
+ return isComplete;
+ }
+
+ /*
+ * This is the template method that splits the Java2WSDL generation cycle
+ * into phase / steps.
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#generateWSDL(java.lang.String[])
+ */
+ public void generateWSDL(Map commandLineOptions)
+ {
+ try
+ {
+ // load the user options into an easy to access abstraction
+ genParams = new GenerationParameters(commandLineOptions);
+
+ // if the WSDL Model generation was successul
+ if ( buildWSDLDocument() )
+ {
+ // multicast event for generation of wsdl model
+ multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_CREATION);
+ // if the serialization of the generated (and fixed) model
+ // is successful
+ if (serializeWSDLDocument()) {
+ // multicast event for writing of the WSDL Model to
+ // supplied output stream
+ multicastGenPhaseCompletionEvent(WSDLGenListener.WSDL_MODEL_WRITING);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void generateWSDL(String[] args)
+ {
+ // if the argument input are found to be valid
+ if (validateInputArgs(args))
+ {
+ //multicast event for input args validation complete
+ multicastGenPhaseCompletionEvent(WSDLGenListener.INPUT_ARGS_VALIDATION);
+ generateWSDL(commandLineOptions);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#addWSDLGenListener(tuscany.tools.WSDLGenListener)
+ */
+ public void addWSDLGenListener(WSDLGenListener l) {
+ genPhaseListeners.add(l);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#removeWSDLGenListener(tuscany.tools.WSDLGenListener)
+ */
+ public void removeWSDLGenListener(WSDLGenListener l) {
+ genPhaseListeners.remove(l);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#getCommandLineOptions()
+ */
+ public Map getCommandLineOptions() {
+ return commandLineOptions;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#setCommandLineOptoins(java.util.Map)
+ */
+ public void setCommandLineOptoins(Map cmdLineOpts) {
+ commandLineOptions = cmdLineOpts;
+ }
+
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#getOutputStream()
+ */
+ public OutputStream getOutputStream() {
+ return outputStream;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see tuscany.tools.Java2WSDLGeneratorIfc#setOutputStream(java.io.OutputStream)
+ */
+ public void setOutputStream(OutputStream outStream) {
+ outputStream = outStream;
+ }
+
+
+ public TuscanyJava2WSDLBuilder getJava2WsdlBuilder()
+ {
+ return java2WsdlBuilder;
+ }
+
+ public void setJava2WsdlBuilder(TuscanyJava2WSDLBuilder java2WsdlBuilder)
+ {
+ this.java2WsdlBuilder = java2WsdlBuilder;
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
new file mode 100644
index 0000000000..67609445ae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/SchemaBuilder.java
@@ -0,0 +1,524 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaGroupBase;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.XmlSchemaType;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.ws.java2wsdl.Java2WSDLUtils;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JProperty;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Type;
+import commonj.sdo.helper.XSDHelper;
+
+public class SchemaBuilder implements TuscanyJava2WSDLConstants {
+ public static final String NAME_SPACE_PREFIX = "stn_";
+
+ private static int prefixCount = 1;
+
+ public static final String MIXED = "mixed";
+
+ public static final String GROUP = "group";
+
+ protected String attrFormDefault = null;
+
+ protected String elementFormDefault = null;
+
+ protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection();
+
+ private Hashtable schemaMap = new Hashtable();
+
+ protected Hashtable targetNamespacePrefixMap = new Hashtable();
+
+ protected TuscanyTypeTable typeTable = new TuscanyTypeTable();
+
+ protected Map schemaLocationMap = null;
+
+ private ClassLoader classLoader;
+
+ protected SchemaBuilder(XmlSchemaCollection schemaCollection,
+ Hashtable schemaMap,
+ Hashtable nsPrefixMap,
+ TuscanyTypeTable typeTable,
+ String attrFormDef,
+ String eleFormDef,
+ Map schemaLocMap,
+ ClassLoader classLoader) {
+ this.schemaMap = schemaMap;
+ this.xmlSchemaCollection = schemaCollection;
+ this.targetNamespacePrefixMap = nsPrefixMap;
+ this.typeTable = typeTable;
+ this.schemaLocationMap = schemaLocMap;
+ this.classLoader = classLoader;
+ this.attrFormDefault = attrFormDef;
+ this.elementFormDefault = eleFormDef;
+ }
+
+ private boolean isSDO(JClass javaType) throws Exception {
+ Class sdoClass = Class.forName(javaType.getQualifiedName(),
+ true,
+ classLoader);
+ return DataObject.class.isAssignableFrom(sdoClass);
+ }
+
+ private void buildComplexTypeContents_JavaType(JClass javaType,
+ XmlSchemaComplexType complexType,
+ XmlSchema xmlSchema) throws Exception {
+ JProperty[] properties = javaType.getDeclaredProperties();
+
+ for (int i = 0; i < properties.length; i++) {
+ JProperty property = properties[i];
+ String propertyName = property.getType().getQualifiedName();
+ boolean isArryType = property.getType().isArrayType();
+ if (isArryType) {
+ propertyName = property.getType().getArrayComponentType().getQualifiedName();
+ }
+
+ if (typeTable.isSimpleType(propertyName)) {
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(getCorrectName(property.getSimpleName()));
+ elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyName));
+ ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1);
+ if (isArryType) {
+ elt1.setMaxOccurs(Long.MAX_VALUE);
+ elt1.setMinOccurs(0);
+ }
+ } else {
+ QName schemaTypeName = null;
+ if (isArryType) {
+ schemaTypeName = generateSchema(property.getType().getArrayComponentType());
+ } else {
+ schemaTypeName = generateSchema(property.getType());
+ }
+
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(getCorrectName(property.getSimpleName()));
+ elt1.setSchemaTypeName(schemaTypeName);
+ ((XmlSchemaGroupBase) complexType.getParticle()).getItems().add(elt1);
+
+ if (isArryType) {
+ elt1.setMaxOccurs(Long.MAX_VALUE);
+ elt1.setMinOccurs(0);
+ }
+
+ addImports(xmlSchema,
+ schemaTypeName);
+ }
+ }
+ }
+
+ protected QName buildSchema_JavaType(JClass javaType) throws Exception {
+ QName schemaTypeName = typeTable.getComplexSchemaTypeName(javaType, this.classLoader);
+ if (schemaTypeName == null) {
+ String simpleName = javaType.getSimpleName();
+
+ String packageName = javaType.getContainingPackage().getQualifiedName();
+
+ String targetNameSpace =
+ Java2WSDLUtils.schemaNamespaceFromClassName(javaType.getQualifiedName(), this.classLoader)
+ .toString();
+
+ XmlSchema xmlSchema = getXmlSchema(targetNameSpace);
+ String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace);
+
+ schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix);
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+ complexType.setName(simpleName);
+
+ XmlSchemaSequence sequence = new XmlSchemaSequence();
+ complexType.setParticle(sequence);
+
+ createGlobalElement(xmlSchema,
+ complexType,
+ schemaTypeName);
+ xmlSchema.getItems().add(complexType);
+ xmlSchema.getSchemaTypes().add(schemaTypeName,
+ complexType);
+
+ // adding this type to the table
+ // typeTable.addComplexScheam(name, complexType.getQName());
+ typeTable.addComplexSchemaType(targetNameSpace,
+ simpleName,
+ schemaTypeName);
+ buildComplexTypeContents_JavaType(javaType,
+ complexType,
+ xmlSchema);
+ }
+ return schemaTypeName;
+ }
+
+ protected QName buildSchema_SDO(Type dataType) // throws Exception
+ {
+ QName schemaTypeName = typeTable.getComplexSchemaTypeName(dataType.getURI(),
+ dataType.getName());
+
+ if (schemaTypeName == null) {
+ // invoke XSDHelper to generate schema for this sdo type
+ XSDHelper xsdHelper = SDOUtil.createXSDHelper(SDOUtil.createTypeHelper());
+ // it is better to check if XSDHelper can generate the schema
+ if (xsdHelper.isXSD(dataType)) {
+ // if schemalocations for xsd has been specified, include them
+ includeExtXSD(dataType);
+ } else {
+ List typeList = new Vector();
+ typeList.add(dataType);
+
+ // the xsdhelper returns a string that contains the schemas for this type
+ String schemaDefns = xsdHelper.generate(typeList,
+ schemaLocationMap);
+
+ // extract the schema elements and store them in the schema map
+ extractSchemas(schemaDefns);
+ }
+ // since the XSDHelper will not return the type name, create it and store it in typetable
+ schemaTypeName = new QName(dataType.getURI(), dataType.getName(), generatePrefix());
+ typeTable.addComplexSchemaType(dataType.getURI(),
+ dataType.getName(),
+ schemaTypeName);
+
+ }
+ return schemaTypeName;
+ }
+
+ public QName generateSchema(JClass javaType) throws Exception {
+ if (isSDO(javaType)) {
+ Type dataType = createDataObject(javaType).getType();
+ return buildSchema_SDO(dataType);
+ } else {
+ return buildSchema_JavaType(javaType);
+ }
+ }
+
+ private XmlSchema getXmlSchema(String targetNamespace) {
+ XmlSchema xmlSchema;
+
+ if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) {
+ String targetNamespacePrefix = generatePrefix();
+
+ xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection);
+ xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting());
+ xmlSchema.setElementFormDefault(getElementFormDefaultSetting());
+
+ targetNamespacePrefixMap.put(targetNamespace,
+ targetNamespacePrefix);
+ schemaMap.put(targetNamespace,
+ xmlSchema);
+
+ NamespaceMap prefixmap = new NamespaceMap();
+ prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX,
+ TuscanyTypeTable.XML_SCHEMA_URI);
+ prefixmap.put(targetNamespacePrefix,
+ targetNamespace);
+ xmlSchema.setNamespaceContext(prefixmap);
+ }
+ return xmlSchema;
+ }
+
+ /**
+ * JAM convert first name of an attribute into UpperCase as an example if there is a instance variable called foo in a bean , then Jam give that
+ * as Foo so this method is to correct that error
+ *
+ * @param wrongName
+ * @return the right name, using english as the locale for case conversion
+ */
+ public static String getCorrectName(String wrongName) {
+ if (wrongName.length() > 1) {
+ return wrongName.substring(0,
+ 1).toLowerCase(Locale.ENGLISH)
+ + wrongName.substring(1,
+ wrongName.length());
+ } else {
+ return wrongName.substring(0,
+ 1).toLowerCase(Locale.ENGLISH);
+ }
+ }
+
+ private String addImports(XmlSchema xmlSchema, QName schemaTypeName) {
+ String prefix = null;
+ String[] prefixes = xmlSchema.getNamespaceContext().getDeclaredPrefixes();
+ for (int count = 0; count < prefixes.length; ++count) {
+ if (schemaTypeName.getNamespaceURI().
+ equals(xmlSchema.getNamespaceContext().getNamespaceURI(prefixes[count])) ) {
+ return prefixes[count];
+ }
+ }
+
+ // the following lines are executed only if a prefix was not found which implies that the
+ // schemaTypeName was not imported earlier and also it does not belong to the targetnamespace
+ String schemaLocation = null;
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(schemaTypeName.getNamespaceURI());
+ xmlSchema.getItems().add(importElement);
+ prefix = generatePrefix();
+ //it is safe to cast like this since it was this class that instantiated the
+ //NamespaceContext and assigned it to an instance of a NamespaceMap (see method getXmlSchema)
+ ((NamespaceMap)xmlSchema.getNamespaceContext()).put(prefix,
+ schemaTypeName.getNamespaceURI());
+
+ return prefix;
+ }
+
+ private String formGlobalElementName(String typeName) {
+ String firstChar = typeName.substring(0,
+ 1);
+ return typeName.replaceFirst(firstChar,
+ firstChar.toLowerCase());
+ }
+
+ private void createGlobalElement(XmlSchema xmlSchema,
+ XmlSchemaComplexType complexType,
+ QName elementName) {
+ XmlSchemaElement globalElement = new XmlSchemaElement();
+ globalElement.setSchemaTypeName(complexType.getQName());
+ globalElement.setName(formGlobalElementName(complexType.getName()));
+ globalElement.setQName(elementName);
+
+ xmlSchema.getItems().add(globalElement);
+ xmlSchema.getElements().add(elementName,
+ globalElement);
+ }
+
+ private DataObject createDataObject(JClass sdoClass) throws Exception {
+ Class sdoType = Class.forName(sdoClass.getQualifiedName(),
+ true,
+ classLoader);
+
+ Constructor constructor = sdoType.getDeclaredConstructor(new Class[0]);
+ constructor.setAccessible(true);
+ Object instance = constructor.newInstance(new Object[0]);
+ return (DataObject) instance;
+ }
+
+ private String generatePrefix() {
+ return NAME_SPACE_PREFIX + prefixCount++;
+ }
+
+ private void includeExtXSD(Type dataType) {
+ // now we know there is a type for which the xsd must come from outside
+ // create a schema for the namespace of this type and add an include in it for
+ // the xsd that is defined externally
+ XmlSchema xmlSchema = getXmlSchema(dataType.getURI());
+
+ // ideally there could be more than one external schema defintions for a namespace
+ // and hence schemalocations will be a list of locations
+ // List schemaLocations = (List)schemaLocationMap.get(dataType.getURI());
+
+ // since as per the specs the input to XSDHelper is a map of <String, String> allowing
+ // only one schemalocation for a namespace. So for now this single location will be
+ // picked up and put into a list
+ List schemaLocations = new Vector();
+
+ if (schemaLocationMap.get(dataType.getURI()) != null) {
+ schemaLocations.add(schemaLocationMap.get(dataType.getURI()));
+ }
+
+ if (schemaLocations.size() <= 0) {
+ schemaLocations.add(DEFAULT_SCHEMA_LOCATION);
+ }
+
+ Iterator includesIterator = xmlSchema.getIncludes().getIterator();
+ Iterator schemaLocIterator = schemaLocations.iterator();
+ String aSchemaLocation = null;
+ boolean includeExists = false;
+ // include all external schema locations
+ while (schemaLocIterator.hasNext()) {
+ aSchemaLocation = (String) schemaLocIterator.next();
+ while (includesIterator.hasNext()) {
+ if (!includeExists
+ && aSchemaLocation.equals(((XmlSchemaInclude) includesIterator.next()).getSchemaLocation())) {
+ includeExists = true;
+ }
+ }
+
+ if (!includeExists) {
+ XmlSchemaInclude includeElement = new XmlSchemaInclude();
+ includeElement.setSchemaLocation(aSchemaLocation);
+ xmlSchema.getIncludes().add(includeElement);
+ xmlSchema.getItems().add(includeElement);
+ }
+ }
+
+ }
+
+ private void extractSchemas(String schemaDefns) {
+ // load each schema element and add it to the schema map
+
+ String token = getToken(schemaDefns);
+ int curIndex = schemaDefns.indexOf(token);
+ int nextIndex = schemaDefns.indexOf(token,
+ curIndex + token.length());
+
+ while (curIndex != -1) {
+ StringReader sr = null;
+ if (nextIndex != -1)
+ sr = new StringReader(schemaDefns.substring(curIndex,
+ nextIndex));
+ else
+ sr = new StringReader(schemaDefns.substring(curIndex));
+
+ XmlSchemaCollection collection = new XmlSchemaCollection();
+ XmlSchema aSchema = collection.read(sr,
+ null);
+ addSchemaToMap(aSchema);
+
+ curIndex = nextIndex;
+ nextIndex = schemaDefns.indexOf(token,
+ curIndex + token.length());
+ }
+ }
+
+ private void addSchemaToMap(XmlSchema extractedSchema) {
+ // check if a Schema object already exists in schema map for targetNamespace of this schema element
+ // if it does then copy the contents of this schema element to the existing one, ensuring that
+ // duplicate elements are not created. i.e. before adding some child element like 'include' or 'import'
+ // check if it already exists, if it does don't add this
+ XmlSchema existingSchema = (XmlSchema) schemaMap.get(extractedSchema.getTargetNamespace());
+
+ if (existingSchema == null) {
+ extractedSchema.setAttributeFormDefault(getAttrFormDefaultSetting());
+ extractedSchema.setElementFormDefault(getElementFormDefaultSetting());
+ schemaMap.put(extractedSchema.getTargetNamespace(),
+ extractedSchema);
+
+ } else {
+ copySchemaItems(existingSchema,
+ extractedSchema);
+ }
+ }
+
+ private void copySchemaItems(XmlSchema existingSchema, XmlSchema aSchema) {
+ // items to copy are imports, includes, elements, types ...
+ // each item is checked if it is a duplicate entry and copied only if it isn't
+ Iterator itemsIterator = aSchema.getItems().getIterator();
+ Object schemaObject = null;
+ XmlSchemaElement schemaElement = null;
+ XmlSchemaType schemaType = null;
+ XmlSchemaInclude schemaInclude = null;
+ QName qName = null;
+ List existingIncludes = getExistingIncludes(existingSchema);
+
+ while (itemsIterator.hasNext()) {
+ schemaObject = itemsIterator.next();
+ if (schemaObject instanceof XmlSchemaElement) {
+ schemaElement = (XmlSchemaElement) schemaObject;
+ qName = schemaElement.getQName();
+ // if the element does not exist in the existing schema
+ if (existingSchema.getElementByName(qName) == null) {
+ // add it to the existing schema
+ existingSchema.getElements().add(qName,
+ schemaElement);
+ existingSchema.getItems().add(schemaElement);
+ }
+ } else if (schemaObject instanceof XmlSchemaType) {
+ schemaType = (XmlSchemaType) itemsIterator.next();
+ qName = schemaType.getQName();
+ // if the element does not exist in the existing schema
+ if (existingSchema.getElementByName(qName) == null) {
+ // add it to the existing schema
+ existingSchema.getSchemaTypes().add(qName,
+ schemaType);
+ existingSchema.getItems().add(schemaType);
+ // add imports
+ addImports(existingSchema,
+ qName);
+ }
+ } else if (schemaObject instanceof XmlSchemaInclude) {
+ schemaInclude = (XmlSchemaInclude) itemsIterator.next();
+ if (!existingIncludes.contains(schemaInclude.getSchemaLocation())) {
+ existingSchema.getIncludes().add(schemaInclude);
+ existingSchema.getItems().add(schemaInclude);
+ }
+ }
+ }
+ }
+
+ private List getExistingIncludes(XmlSchema xmlSchema) {
+ List includeSchemaLocations = new Vector();
+ Iterator iterator = xmlSchema.getIncludes().getIterator();
+
+ while (iterator.hasNext()) {
+ includeSchemaLocations.add(((XmlSchemaInclude) iterator.next()).getSchemaLocation());
+ }
+ return includeSchemaLocations;
+ }
+
+ private XmlSchemaForm getAttrFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ private XmlSchemaForm getElementFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ private String getToken(String s) {
+ // get the schema element name eg. <xs:schema or <xsd:schema. We only know that 'schema' will be used
+ // but not sure what suffix is used. Hence this method to get the actual element name used
+ int i = s.indexOf(SCHEMA_ELEMENT_NAME);
+ int j = s.substring(0,
+ i).lastIndexOf("<");
+ return s.substring(j,
+ i + SCHEMA_ELEMENT_NAME.length());
+ }
+
+ public String getAttrFormDefault() {
+ return attrFormDefault;
+ }
+
+ public void setAttrFormDefault(String attrFormDefault) {
+ this.attrFormDefault = attrFormDefault;
+ }
+
+ public String getElementFormDefault() {
+ return elementFormDefault;
+ }
+
+ public void setElementFormDefault(String elementFormDefault) {
+ this.elementFormDefault = elementFormDefault;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
new file mode 100644
index 0000000000..e58d729981
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2OMBuilder.java
@@ -0,0 +1,521 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.codehaus.jam.JMethod;
+
+public class TuscanyJava2OMBuilder implements Java2WSDLConstants {
+
+ private TuscanyTypeTable typeTable = null;
+
+ private static int prefixCount = 1;
+
+ private static final String NAMESPACE_PREFIX = "ns";
+
+ private JMethod method[];
+
+ private Collection schemaCollection;
+
+ private GenerationParameters generationParams;
+
+ private OMNamespace ns1;
+
+ private OMNamespace soap;
+
+ private OMNamespace soap12;
+
+ private OMNamespace tns;
+
+ private OMNamespace wsdl;
+
+ private OMNamespace mime;
+
+ private OMNamespace http;
+
+ public TuscanyJava2OMBuilder(JMethod[] method,
+ Collection schemaCollection,
+ TuscanyTypeTable typeTab,
+ GenerationParameters genParams) {
+ this.method = method;
+ this.schemaCollection = schemaCollection;
+ this.typeTable = typeTab;
+ this.generationParams = genParams;
+ }
+
+ public OMElement generateOM() throws Exception {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
+ DEFAULT_WSDL_NAMESPACE_PREFIX);
+ OMElement ele = fac.createOMElement("definitions",
+ wsdl);
+
+ ele.addAttribute("targetNamespace",
+ generationParams.getTargetNamespace(),
+ null);
+ generateNamespaces(fac,
+ ele);
+ generateTypes(fac,
+ ele);
+ generateMessages(fac,
+ ele);
+ generatePortType(fac,
+ ele);
+ generateBinding(fac,
+ ele);
+ generateService(fac,
+ ele);
+ return ele;
+ }
+
+ private void generateNamespaces(OMFactory fac, OMElement defintions) throws Exception {
+ soap = defintions.declareNamespace(URI_WSDL11_SOAP,
+ SOAP11_PREFIX);
+ tns = defintions.declareNamespace(generationParams.getTargetNamespace(),
+ generationParams.getTargetNamespacePrefix());
+ soap12 = defintions.declareNamespace(URI_WSDL12_SOAP,
+ SOAP12_PREFIX);
+ http = defintions.declareNamespace(HTTP_NAMESPACE,
+ HTTP_PREFIX);
+ mime = defintions.declareNamespace(MIME_NAMESPACE,
+ MIME_PREFIX);
+ }
+
+ private void generateTypes(OMFactory fac, OMElement defintions) throws Exception {
+ OMElement wsdlTypes = fac.createOMElement("types",
+ wsdl);
+ StringWriter writer = new StringWriter();
+
+ // wrap the Schema elements with this start and end tags to create a
+ // document root
+ // under which the schemas can fall into
+ writer.write("<xmlSchemas>");
+ writeSchemas(writer);
+ writer.write("</xmlSchemas>");
+
+ XMLStreamReader xmlReader = XMLInputFactory.newInstance()
+ .createXMLStreamReader(new ByteArrayInputStream(writer.toString()
+ .getBytes()));
+
+ StAXOMBuilder staxOMBuilders = new StAXOMBuilder(fac, xmlReader);
+ OMElement documentElement = staxOMBuilders.getDocumentElement();
+
+
+ Iterator iterator = documentElement.getChildElements();
+ while (iterator.hasNext()) {
+ wsdlTypes.addChild((OMNode) iterator.next());
+ }
+ defintions.addChild(wsdlTypes);
+ }
+
+ private void writeSchemas(StringWriter writer) {
+ Iterator iterator = schemaCollection.iterator();
+ XmlSchema xmlSchema = null;
+
+ while (iterator.hasNext()) {
+ xmlSchema = (XmlSchema) iterator.next();
+ // typeIterator = xmlSchema.getSchemaTypes().getValues();
+ /*
+ * while (typeIterator.hasNext()) { xmlSchema.getItems().add((XmlSchemaObject) typeIterator.next()); }
+ */
+ xmlSchema.write(writer);
+ }
+ }
+
+ private void generateMessages(OMFactory fac, OMElement definitions) throws Exception {
+ Hashtable namespaceMap = new Hashtable();
+ String namespacePrefix = null;
+ String namespaceURI = null;
+ QName messagePartType = null;
+ for (int i = 0; i < method.length; i++) {
+ JMethod jmethod = method[i];
+
+ if (jmethod.isPublic()) {
+ // Request Message
+ OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME,
+ wsdl);
+ requestMessge.addAttribute(ATTRIBUTE_NAME,
+ jmethod.getSimpleName() + MESSAGE_SUFFIX,
+ null);
+ definitions.addChild(requestMessge);
+
+ // only if a type for the message part has already been defined
+ if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(),
+ jmethod.getSimpleName())) != null) {
+ namespaceURI = messagePartType.getNamespaceURI();
+ // avoid duplicate namespaces
+ if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
+ namespacePrefix = generatePrefix();
+ namespaceMap.put(namespaceURI,
+ namespacePrefix);
+ }
+
+ OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME,
+ wsdl);
+ requestMessge.addChild(requestPart);
+ requestPart.addAttribute(ATTRIBUTE_NAME,
+ "part1",
+ null);
+
+ requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+ namespacePrefix + COLON_SEPARATOR
+ + jmethod.getSimpleName(),
+ null);
+ }
+
+ // only if a type for the message part has already been defined
+ if ((messagePartType = typeTable.getComplexSchemaTypeName(generationParams.getSchemaTargetNamespace(),
+ jmethod.getSimpleName()
+ + RESPONSE)) != null) {
+ namespaceURI = messagePartType.getNamespaceURI();
+ if ((namespacePrefix = (String) namespaceMap.get(namespaceURI)) == null) {
+ namespacePrefix = generatePrefix();
+ namespaceMap.put(namespaceURI,
+ namespacePrefix);
+ }
+ // Response Message
+ OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME,
+ wsdl);
+ responseMessge.addAttribute(ATTRIBUTE_NAME,
+ jmethod.getSimpleName() + RESPONSE_MESSAGE,
+ null);
+ definitions.addChild(responseMessge);
+ OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME,
+ wsdl);
+ responseMessge.addChild(responsePart);
+ responsePart.addAttribute(ATTRIBUTE_NAME,
+ "part1",
+ null);
+
+ responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+ namespacePrefix + COLON_SEPARATOR
+ + jmethod.getSimpleName() + RESPONSE,
+ null);
+ }
+ }
+ }
+
+ // now add these unique namespaces to the the definitions element
+ Enumeration enumeration = namespaceMap.keys();
+ while (enumeration.hasMoreElements()) {
+ namespaceURI = (String) enumeration.nextElement();
+ definitions.declareNamespace(namespaceURI,
+ (String) namespaceMap.get(namespaceURI));
+ }
+ }
+
+ /**
+ * Generate the porttypes
+ */
+ private void generatePortType(OMFactory fac, OMElement defintions) {
+ JMethod jmethod = null;
+ OMElement operation = null;
+ OMElement message = null;
+ OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME,
+ wsdl);
+ defintions.addChild(portType);
+ portType.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName() + PORT_TYPE_SUFFIX,
+ null);
+ // adding message refs
+ for (int i = 0; i < method.length; i++) {
+ jmethod = method[i];
+
+ if (jmethod.isPublic()) {
+ operation = fac.createOMElement(OPERATION_LOCAL_NAME,
+ wsdl);
+ portType.addChild(operation);
+ operation.addAttribute(ATTRIBUTE_NAME,
+ jmethod.getSimpleName(),
+ null);
+
+ message = fac.createOMElement(IN_PUT_LOCAL_NAME,
+ wsdl);
+ message.addAttribute(MESSAGE_LOCAL_NAME,
+ tns.getPrefix() + COLON_SEPARATOR + jmethod.getSimpleName()
+ + MESSAGE_SUFFIX,
+ null);
+ operation.addChild(message);
+
+ if (!jmethod.getReturnType().isVoidType()) {
+ message = fac.createOMElement(OUT_PUT_LOCAL_NAME,
+ wsdl);
+ message.addAttribute(MESSAGE_LOCAL_NAME,
+ tns.getPrefix() + COLON_SEPARATOR
+ + jmethod.getSimpleName() + RESPONSE_MESSAGE,
+ null);
+ operation.addChild(message);
+ }
+ }
+ }
+
+ }
+
+ /**
+ * Generate the service
+ */
+ public void generateService(OMFactory fac, OMElement defintions) {
+ OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME,
+ wsdl);
+ defintions.addChild(service);
+ service.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName(),
+ null);
+ OMElement port = fac.createOMElement(PORT,
+ wsdl);
+ service.addChild(port);
+ port.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName() + SOAP11PORT,
+ null);
+ port.addAttribute(BINDING_LOCAL_NAME,
+ tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName()
+ + BINDING_NAME_SUFFIX,
+ null);
+ addExtensionElement(fac,
+ port,
+ soap,
+ SOAP_ADDRESS,
+ LOCATION,
+ generationParams.getLocationUri() + generationParams.getServiceName());
+
+ port = fac.createOMElement(PORT,
+ wsdl);
+ service.addChild(port);
+ port.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName() + SOAP12PORT,
+ null);
+ port.addAttribute(BINDING_LOCAL_NAME,
+ tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName()
+ + SOAP12BINDING_NAME_SUFFIX,
+ null);
+ addExtensionElement(fac,
+ port,
+ soap12,
+ SOAP_ADDRESS,
+ LOCATION,
+ generationParams.getLocationUri() + generationParams.getServiceName());
+ }
+
+ /**
+ * Generate the bindings
+ */
+ private void generateBinding(OMFactory fac, OMElement defintions) throws Exception {
+ generateSoap11Binding(fac,
+ defintions);
+ generateSoap12Binding(fac,
+ defintions);
+ }
+
+ private void generateSoap11Binding(OMFactory fac, OMElement defintions) throws Exception {
+ OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME,
+ wsdl);
+ defintions.addChild(binding);
+ binding.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName() + BINDING_NAME_SUFFIX,
+ null);
+ binding.addAttribute("type",
+ tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName()
+ + PORT_TYPE_SUFFIX,
+ null);
+
+ addExtensionElement(fac,
+ binding,
+ soap,
+ BINDING_LOCAL_NAME,
+ TRANSPORT,
+ TRANSPORT_URI,
+ STYLE,
+ generationParams.getStyle());
+
+ for (int i = 0; i < method.length; i++) {
+ JMethod jmethod = method[i];
+ if (jmethod.isPublic()) {
+ OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
+ wsdl);
+ binding.addChild(operation);
+
+ addExtensionElement(fac,
+ operation,
+ soap,
+ OPERATION_LOCAL_NAME,
+ SOAP_ACTION,
+ URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(),
+ STYLE,
+ generationParams.getStyle());
+ operation.addAttribute(ATTRIBUTE_NAME,
+ jmethod.getSimpleName(),
+ null);
+
+ OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
+ wsdl);
+ addExtensionElement(fac,
+ input,
+ soap,
+ SOAP_BODY,
+ SOAP_USE,
+ generationParams.getUse(),
+ "namespace",
+ generationParams.getTargetNamespace());
+ operation.addChild(input);
+
+ if (!jmethod.getReturnType().isVoidType()) {
+ OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
+ wsdl);
+ addExtensionElement(fac,
+ output,
+ soap,
+ SOAP_BODY,
+ SOAP_USE,
+ generationParams.getUse(),
+ "namespace",
+ generationParams.getTargetNamespace());
+ operation.addChild(output);
+ }
+ }
+ }
+ }
+
+ private void generateSoap12Binding(OMFactory fac, OMElement defintions) throws Exception {
+ OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME,
+ wsdl);
+ defintions.addChild(binding);
+ binding.addAttribute(ATTRIBUTE_NAME,
+ generationParams.getServiceName() + SOAP12BINDING_NAME_SUFFIX,
+ null);
+ binding.addAttribute("type",
+ tns.getPrefix() + COLON_SEPARATOR + generationParams.getServiceName()
+ + PORT_TYPE_SUFFIX,
+ null);
+
+ addExtensionElement(fac,
+ binding,
+ soap12,
+ BINDING_LOCAL_NAME,
+ TRANSPORT,
+ TRANSPORT_URI,
+ STYLE,
+ generationParams.getStyle());
+
+ for (int i = 0; i < method.length; i++) {
+ JMethod jmethod = method[i];
+
+ if (jmethod.isPublic()) {
+ OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
+ wsdl);
+ binding.addChild(operation);
+ operation.declareNamespace(URI_WSDL12_SOAP,
+ SOAP12_PREFIX);
+
+ addExtensionElement(fac,
+ operation,
+ soap12,
+ OPERATION_LOCAL_NAME,
+ SOAP_ACTION,
+ URN_PREFIX + COLON_SEPARATOR + jmethod.getSimpleName(),
+ STYLE,
+ generationParams.getStyle());
+ operation.addAttribute(ATTRIBUTE_NAME,
+ jmethod.getSimpleName(),
+ null);
+
+ OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME,
+ wsdl);
+ addExtensionElement(fac,
+ input,
+ soap12,
+ SOAP_BODY,
+ SOAP_USE,
+ generationParams.getUse(),
+ "namespace",
+ generationParams.getTargetNamespace());
+ operation.addChild(input);
+
+ if (!jmethod.getReturnType().isVoidType()) {
+ OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME,
+ wsdl);
+ addExtensionElement(fac,
+ output,
+ soap12,
+ SOAP_BODY,
+ SOAP_USE,
+ generationParams.getUse(),
+ "namespace",
+ generationParams.getTargetNamespace());
+ operation.addChild(output);
+ }
+ }
+ }
+ }
+
+ private void addExtensionElement(OMFactory fac,
+ OMElement element,
+ OMNamespace namespace,
+ String name,
+ String att1Name,
+ String att1Value,
+ String att2Name,
+ String att2Value) {
+ OMElement soapbinding = fac.createOMElement(name,
+ namespace);
+ element.addChild(soapbinding);
+ soapbinding.addAttribute(att1Name,
+ att1Value,
+ null);
+ soapbinding.addAttribute(att2Name,
+ att2Value,
+ null);
+ }
+
+ private void addExtensionElement(OMFactory fac,
+ OMElement element,
+ OMNamespace namespace,
+ String name,
+ String att1Name,
+ String att1Value) {
+ OMElement soapbinding = fac.createOMElement(name,
+ namespace);
+ element.addChild(soapbinding);
+ soapbinding.addAttribute(att1Name,
+ att1Value,
+ null);
+ }
+
+ private String generatePrefix() {
+ return NAMESPACE_PREFIX + prefixCount++;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.java
new file mode 100644
index 0000000000..b23726f6fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLBuilder.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.tools.java2wsdl.generate;
+
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+
+public class TuscanyJava2WSDLBuilder implements Java2WSDLConstants {
+
+ private OutputStream out;
+ private String className;
+ private ClassLoader classLoader;
+ private String wsdlPrefix = "wsdl";
+
+ // these apply for the WSDL
+ private GenerationParameters generationParams;
+
+ private OMElement wsdlDocument = null;
+
+ public String getWsdlPrefix() {
+ return wsdlPrefix;
+ }
+
+ public void setWsdlPrefix(String wsdlPrefix) {
+ this.wsdlPrefix = wsdlPrefix;
+ }
+
+ public TuscanyJava2WSDLBuilder(GenerationParameters genParams) {
+ this.generationParams = genParams;
+ }
+
+ /**
+ * Externally visible generator method
+ *
+ * @throws Exception
+ */
+ public void buildWSDL() throws Exception {
+ ArrayList excludeOpeartion = new ArrayList();
+ excludeOpeartion.add("init");
+ excludeOpeartion.add("setOperationContext");
+ excludeOpeartion.add("destroy");
+
+ TuscanyWSDLTypesGenerator typesGenerator = new TuscanyWSDLTypesGenerator(generationParams);
+ typesGenerator.setExcludeMethods(excludeOpeartion);
+ Collection schemaCollection = typesGenerator.buildWSDLTypes();
+
+ TuscanyJava2OMBuilder java2OMBuilder =
+ new TuscanyJava2OMBuilder(typesGenerator.getMethods(), schemaCollection, typesGenerator
+ .getTypeTable(), generationParams);
+
+ wsdlDocument = java2OMBuilder.generateOM();
+ }
+
+ public OMElement getWsdlDocument() {
+ return wsdlDocument;
+ }
+
+ public void setWsdlDocument(OMElement wsdlDocument) {
+ this.wsdlDocument = wsdlDocument;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.java
new file mode 100644
index 0000000000..cde870fff4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLConstants.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.tools.java2wsdl.generate;
+
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+
+/**
+ * This is a extension from the Axis2 Java2WSDLConstants to handle additions specific to Tuscany.
+ * This class can be done away with once Axis2 is also enhanced to support these
+ * additional options.
+ *
+ */
+public interface TuscanyJava2WSDLConstants extends Java2WSDLConstants
+{
+ public static final char OPEN_BRACKET = '[';
+ public static final char COMMA = ',';
+ public static final char CLOSE_BRACKET = ']';
+ public static final String DEFAULT_SCHEMA_LOCATION = "*.xsd";
+ public static final String SCHEMA_ELEMENT_NAME = "schema";
+
+ String FORM_DEFAULT_QUALIFIED = "qualified";
+ String FORM_DEFAULT_UNQUALIFIED = "unqualified";
+
+ //short options
+ String IMPORT_XSD_OPTION = "ixsd"; //option for importing XSDs
+ String ATTR_FORM_DEFAULT_OPTION = "afd";
+ String ELEMENT_FORM_DEFAULT_OPTION = "efd";
+ String EXTRA_CLASSES_DEFAULT_OPTION = "xc";
+
+ //long options
+ String IMPORT_XSD_OPTION_LONG = "import_xsd"; //option for importing XSDs
+ String ATTR_FORM_DEFAULT_OPTION_LONG = "attributeFormDefault";
+ String ELEMENT_FORM_DEFAULT_OPTION_LONG = "elementFormDefault";
+ String EXTRA_CLASSES_DEFAULT_OPTION_LONG = "extraClasses";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.java
new file mode 100644
index 0000000000..6411327abf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLOptionsValidator.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.tools.java2wsdl.generate;
+
+import java.util.ArrayList;
+
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator;
+
+/**
+ * This class is an extension from the Axis2 implementation in order to handle additional optoins
+ * specific to Tuscany. This class can be done away with once Axis2 is also enhanced to support these
+ * additional options.
+ *
+ */
+public class TuscanyJava2WSDLOptionsValidator extends Java2WSDLOptionsValidator implements
+ TuscanyJava2WSDLConstants {
+ public boolean isInvalid(Java2WSDLCommandLineOption option) {
+ boolean invalid;
+ String optionType = option.getOptionType();
+
+ invalid = !((IMPORT_XSD_OPTION).equalsIgnoreCase(optionType)
+ || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)
+ || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION_LONG).equalsIgnoreCase(optionType)
+ || (TuscanyJava2WSDLConstants.EXTRA_CLASSES_DEFAULT_OPTION).equalsIgnoreCase(optionType)
+ || !super.isInvalid(option));
+
+ invalid = validateImportXSDOption(invalid,
+ option);
+
+ return invalid;
+ }
+
+ private boolean validateImportXSDOption(boolean invalid, Java2WSDLCommandLineOption option) {
+ String optionType = option.getOptionType();
+ String schemaNSLocationPair = null;
+
+ if (!invalid && (IMPORT_XSD_OPTION).equalsIgnoreCase(optionType)
+ || (IMPORT_XSD_OPTION_LONG).equalsIgnoreCase(optionType)) {
+ ArrayList optionValues = option.getOptionValues();
+
+ for (int count = 0; count < optionValues.size(); ++count) {
+ schemaNSLocationPair = ((String) optionValues.get(count)).trim();
+ if ((schemaNSLocationPair.charAt(0) != OPEN_BRACKET)
+ || (schemaNSLocationPair.charAt(schemaNSLocationPair.length() - 1) != CLOSE_BRACKET)
+ || (schemaNSLocationPair.indexOf(COMMA) == -1))
+
+ {
+ System.out.println("Schema Namespace-Location pair option not specified properly!!");
+ invalid = true;
+ }
+ }
+ }
+
+ return invalid;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java
new file mode 100644
index 0000000000..4f3371126d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanySchemaGenerator.java
@@ -0,0 +1,410 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.bytecode.MethodTable;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JParameter;
+import org.codehaus.jam.JamClassIterator;
+import org.codehaus.jam.JamService;
+import org.codehaus.jam.JamServiceFactory;
+import org.codehaus.jam.JamServiceParams;
+
+
+public class TuscanySchemaGenerator implements TuscanyJava2WSDLConstants
+{
+ public static final String NAME_SPACE_PREFIX = "stn_";
+ public static final String PERIOD_SEPARATOR = ".";
+ private static int prefixCount = 1;
+
+ protected String attrFormDefault = null;
+ protected String elementFormDefault = null;
+ protected Hashtable targetNamespacePrefixMap = new Hashtable();
+ protected Hashtable schemaMap = new Hashtable();
+ protected Hashtable sdoAnnoMap = new Hashtable();
+ protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection();
+ private TuscanyTypeTable typeTable = new TuscanyTypeTable();
+ protected SchemaBuilder schemaBuilder = null;
+ protected Map schemaLocationMap = null;
+
+ private static final Log log = LogFactory.getLog(SchemaGenerator.class);
+ private ClassLoader classLoader;
+ private String className;
+
+ // to keep loadded method using JAM
+ private JMethod methods [];
+
+ //to store byte code method using Axis 1.x codes
+ private MethodTable methodTable;
+ private String schemaTargetNameSpace;
+ private String schema_namespace_prefix;
+ private Class clazz;
+ private ArrayList excludeMethods = new ArrayList();
+
+ public TuscanySchemaGenerator(ClassLoader loader,
+ String className,
+ String schematargetNamespace,
+ String schematargetNamespacePrefix,
+ Map schemaLocMap)
+ throws Exception
+ {
+ DataObjectUtil.initRuntime();
+ this.classLoader = loader;
+ this.className = className;
+ clazz = Class.forName(className, true, loader);
+ methodTable = new MethodTable(clazz);
+ this.schemaTargetNameSpace = schematargetNamespace;
+ this.schema_namespace_prefix = schematargetNamespacePrefix;
+ this.schemaLocationMap = schemaLocMap;
+
+ initializeSchemaMap(this.schemaTargetNameSpace, this.schema_namespace_prefix);
+ schemaBuilder = new SchemaBuilder(xmlSchemaCollection,
+ schemaMap,
+ targetNamespacePrefixMap,
+ typeTable,
+ getAttrFormDefault(),
+ getElementFormDefault(),
+ schemaLocMap,
+ this.classLoader );
+ }
+
+ /**
+ * Generates schema for all the parameters in method. First generates schema
+ * for all different parameter type and later refers to them.
+ *
+ * @return Returns XmlSchema.
+ * @throws Exception
+ */
+ public Collection buildWSDLTypes() throws Exception
+ {
+ JamServiceFactory factory = JamServiceFactory.getInstance();
+ JamServiceParams jam_service_parms = factory.createServiceParams();
+ //setting the classLoder
+// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader));
+ //it can posible to add the classLoader as well
+ jam_service_parms.addClassLoader(classLoader);
+ jam_service_parms.includeClass(className);
+ JamService service = factory.createService(jam_service_parms);
+
+ JamClassIterator jClassIter = service.getClasses();
+ //all most all the time the ittr will have only one class in it
+ while (jClassIter.hasNext())
+ {
+ JClass jclass = (JClass) jClassIter.next();
+ // serviceName = jclass.getSimpleName();
+ //todo in the future , when we support annotation we can use this
+ //JAnnotation[] annotations = jclass.getAnnotations();
+
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Bean
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+ methods = jclass.getDeclaredMethods();
+
+ // since we do not support overload
+ HashMap uniqueMethods = new HashMap();
+ XmlSchemaComplexType methodSchemaType = null;
+ XmlSchemaSequence sequence = null;
+ QName methodPartSchemaTypeName = null;
+ for (int i = 0; i < methods.length; i++)
+ {
+ String methodName = methods[i].getSimpleName();
+ JMethod jMethod = methods[i];
+ // no need to think abt this method , since that is system
+ // config method
+ if (excludeMethods.contains(jMethod.getSimpleName())) {
+ continue;
+ }
+ //if (jMethod.getSimpleName().equals("init")
+ // || "setOperationContext".equals(jMethod.getSimpleName())
+ // || "destroy".equals(jMethod.getSimpleName()))
+ // continue;
+ if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
+ throw new Exception(
+ " Sorry we don't support methods overloading !!!! ");
+ }
+
+ if (!jMethod.isPublic()) {
+ // no need to generate Schema for non public methods
+ continue;
+ }
+
+ uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+ JParameter [] paras = jMethod.getParameters();
+ String parameterNames [] = null;
+ if (paras.length > 0)
+ {
+ parameterNames = methodTable.getParameterNames(methodName);
+ sequence = new XmlSchemaSequence();
+
+ //create the schema type for the method wrapper
+ methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
+ methodSchemaType.setParticle(sequence);
+ }
+
+ for (int j = 0; j < paras.length; j++)
+ {
+ JParameter methodParameter = paras[j];
+ JClass paraType = methodParameter.getType();
+ generateSchemaForType(sequence, paraType,
+ ( parameterNames != null && parameterNames[j] != null )? parameterNames[j] : methodParameter.getSimpleName());
+ }
+ // for its return type
+ JClass returnType = jMethod.getReturnType();
+ QName methodReturnSchemaTypeName = null;
+
+ if (!returnType.isVoidType())
+ {
+ methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
+ sequence = new XmlSchemaSequence();
+ methodSchemaType.setParticle(sequence);
+ generateSchemaForType(sequence, returnType, "return");
+ }
+ }
+ //generateWrapperElements(methods);
+ }
+ return schemaMap.values();
+ }
+
+ private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception
+ {
+ boolean isArrayType = type.isArrayType();
+ if ( isArrayType )
+ {
+ type = type.getArrayComponentType();
+ }
+
+ String classTypeName = type.getQualifiedName();
+
+ QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName);
+ if ( schemaTypeName == null )
+ {
+ schemaTypeName =
+ schemaBuilder.generateSchema(type);
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ type.isArrayType());
+ addImportORInclude((XmlSchema)schemaMap.get(schemaTargetNameSpace), schemaTypeName);
+
+ }
+ else
+ {
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ type.isArrayType());
+ }
+
+ return schemaTypeName;
+ }
+
+ private void addContentToMethodSchemaType(XmlSchemaSequence sequence,
+ QName schemaTypeName,
+ String paraName,
+ boolean isArray )
+ {
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(paraName);
+ elt1.setSchemaTypeName(schemaTypeName);
+ sequence.getItems().add(elt1);
+
+ if ( isArray )
+ {
+ elt1.setMaxOccurs(Long.MAX_VALUE);
+ elt1.setMinOccurs(0);
+ }
+ }
+
+ private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName)
+ {
+ XmlSchema xmlSchema = (XmlSchema)schemaMap.get(schemaTargetNameSpace);
+ QName elementName = new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix);
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+
+ XmlSchemaElement globalElement = new XmlSchemaElement();
+ globalElement.setSchemaType(complexType);
+ globalElement.setName(formGlobalElementName(localPartName));
+ globalElement.setQName(elementName);
+
+ xmlSchema.getItems().add(globalElement);
+ xmlSchema.getElements().add(elementName, globalElement);
+
+ typeTable.addComplexSchemaType(this.schemaTargetNameSpace, globalElement.getName(), elementName);
+
+ return complexType;
+ }
+
+
+ private String formGlobalElementName(String typeName)
+ {
+ String firstChar = typeName.substring(0,1);
+ return typeName.replaceFirst(firstChar, firstChar.toLowerCase());
+ }
+
+ public TuscanyTypeTable getTypeTable() {
+ return typeTable;
+ }
+
+ public JMethod[] getMethods() {
+ return methods;
+ }
+
+ private String generatePrefix() {
+ return NAME_SPACE_PREFIX + prefixCount++;
+ }
+
+ public void setExcludeMethods(ArrayList excludeMethods) {
+ this.excludeMethods = excludeMethods;
+ }
+
+ private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix)
+ {
+ XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection);
+ xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting());
+ xmlSchema.setElementFormDefault(getElementFormDefaultSetting());
+
+ targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix);
+ schemaMap.put(targetNamespace, xmlSchema);
+
+
+ NamespaceMap prefixmap = new NamespaceMap();
+ prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX, TuscanyTypeTable.XML_SCHEMA_URI);
+ prefixmap.put(targetNamespacePrefix, targetNamespace);
+ xmlSchema.setNamespaceContext(prefixmap);
+ }
+
+ private void setFormDefaults()
+ {
+
+ }
+
+ public Hashtable getSdoAnnoMap() {
+ return sdoAnnoMap;
+ }
+
+ public void setSdoAnnoMap(Hashtable sdoAnnoMap) {
+ this.sdoAnnoMap = sdoAnnoMap;
+ }
+
+ private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName)
+ {
+ //decide whether there must be an import or an include
+ if ( xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI()) )
+ {
+ XmlSchema containingSchema = (XmlSchema)schemaMap.get(schemaTypeName.getNamespaceURI());
+ //if the type is not defined in the Schema then include
+ if ( containingSchema.getTypeByName(schemaTypeName) == null )
+ {
+ String schemaLocation = null;
+ if ( (schemaLocation = (String)schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null )
+ {
+ schemaLocation = DEFAULT_SCHEMA_LOCATION;
+ }
+
+ XmlSchemaInclude includeElement = new XmlSchemaInclude();
+ includeElement.setSchemaLocation(schemaLocation);
+
+ if ( !xmlSchema.getIncludes().contains(includeElement) )
+ {
+ xmlSchema.getIncludes().add(includeElement);
+ }
+ }
+ }
+ else
+ {
+ if (!((NamespaceMap)xmlSchema.getNamespaceContext()).values().
+ contains(schemaTypeName.getNamespaceURI()))
+ {
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(schemaTypeName.getNamespaceURI());
+ xmlSchema.getItems().add(importElement);
+ ((NamespaceMap)xmlSchema.getNamespaceContext()).
+ put(generatePrefix(), schemaTypeName.getNamespaceURI());
+ }
+ }
+ }
+
+ private XmlSchemaForm getAttrFormDefaultSetting()
+ {
+ if ( FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault()) )
+ {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ }
+ else
+ {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ private XmlSchemaForm getElementFormDefaultSetting()
+ {
+ if ( FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault()) )
+ {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ }
+ else
+ {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ public String getAttrFormDefault() {
+ return attrFormDefault;
+ }
+
+ public void setAttrFormDefault(String attrFormDefault) {
+ this.attrFormDefault = attrFormDefault;
+ }
+
+ public String getElementFormDefault() {
+ return elementFormDefault;
+ }
+
+ public void setElementFormDefault(String elementFormDefault) {
+ this.elementFormDefault = elementFormDefault;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java
new file mode 100644
index 0000000000..4abd7a7ce7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyTypeTable.java
@@ -0,0 +1,225 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.ws.java2wsdl.Java2WSDLUtils;
+import org.codehaus.jam.JClass;
+
+public class TuscanyTypeTable
+{
+ public static final String XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
+ public static final String XS_URI_PREFIX = "xs";
+ public static final QName XS_QNAME = new QName(XML_SCHEMA_URI, "schema", XS_URI_PREFIX);
+ public static final String DELIMITER = "#";
+
+ private Hashtable simpleXSDTypes;
+ private Hashtable complexXSDTypes;
+
+ public static String asQualifiedName(String uri, String typeName)
+ {
+ return (uri + DELIMITER + typeName);
+ }
+
+
+ public TuscanyTypeTable()
+ {
+ simpleXSDTypes = new Hashtable();
+ complexXSDTypes = new Hashtable();
+ populateSimpleXSDTypes();
+ populateStdSDOTypes();
+ }
+
+ private void populateStdSDOTypes()
+ {
+ simpleXSDTypes.put("Boolean",
+ new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
+ simpleXSDTypes.put("Byte",
+ new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
+ simpleXSDTypes.put("Bytes",
+ new QName(XML_SCHEMA_URI, "hexBinary", XS_URI_PREFIX));
+ simpleXSDTypes.put("Character",
+ new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
+ simpleXSDTypes.put("DataObject",
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put("Date",
+ new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
+ simpleXSDTypes.put("Day",
+ new QName(XML_SCHEMA_URI, "gDay", XS_URI_PREFIX));
+ simpleXSDTypes.put("Decimal",
+ new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX));
+ simpleXSDTypes.put("Double",
+ new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
+ simpleXSDTypes.put("Duration",
+ new QName(XML_SCHEMA_URI, "duration", XS_URI_PREFIX));
+ simpleXSDTypes.put("Float",
+ new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
+ simpleXSDTypes.put("Int",
+ new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
+ simpleXSDTypes.put("Integer",
+ new QName(XML_SCHEMA_URI, "integer", XS_URI_PREFIX));
+ simpleXSDTypes.put("Long",
+ new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
+ simpleXSDTypes.put("Month",
+ new QName(XML_SCHEMA_URI, "gMonth", XS_URI_PREFIX));
+ simpleXSDTypes.put("monthDay",
+ new QName(XML_SCHEMA_URI, "gMonthDay", XS_URI_PREFIX));
+ simpleXSDTypes.put("Object",
+ new QName(XML_SCHEMA_URI, "anySimpleType", XS_URI_PREFIX));
+ simpleXSDTypes.put("Short",
+ new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
+ simpleXSDTypes.put("String",
+ new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
+ simpleXSDTypes.put("Strings",
+ new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
+ simpleXSDTypes.put("Time",
+ new QName(XML_SCHEMA_URI, "time", XS_URI_PREFIX));
+ simpleXSDTypes.put("Year",
+ new QName(XML_SCHEMA_URI, "gYear", XS_URI_PREFIX));
+ simpleXSDTypes.put("YearMonth",
+ new QName(XML_SCHEMA_URI, "gYearMonth", XS_URI_PREFIX));
+ simpleXSDTypes.put("YearMonthDay",
+ new QName(XML_SCHEMA_URI, "date", XS_URI_PREFIX));
+ simpleXSDTypes.put("URI",
+ new QName(XML_SCHEMA_URI, "anyURI", XS_URI_PREFIX));
+ }
+
+ private void populateSimpleXSDTypes() {
+ //todo pls use the types from org.apache.ws.commons.schema.constants.Constants
+ simpleXSDTypes.put("int",
+ new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.String",
+ new QName(XML_SCHEMA_URI, "string", XS_URI_PREFIX));
+ simpleXSDTypes.put("boolean",
+ new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
+ simpleXSDTypes.put("float",
+ new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
+ simpleXSDTypes.put("double",
+ new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
+ simpleXSDTypes.put("short",
+ new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
+ simpleXSDTypes.put("long",
+ new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
+ simpleXSDTypes.put("byte",
+ new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
+ simpleXSDTypes.put("char",
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Integer",
+ new QName(XML_SCHEMA_URI, "int", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Double",
+ new QName(XML_SCHEMA_URI, "double", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Float",
+ new QName(XML_SCHEMA_URI, "float", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Long",
+ new QName(XML_SCHEMA_URI, "long", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Character",
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Boolean",
+ new QName(XML_SCHEMA_URI, "boolean", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Byte",
+ new QName(XML_SCHEMA_URI, "byte", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Short",
+ new QName(XML_SCHEMA_URI, "short", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.util.Date",
+ new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.util.Calendar",
+ new QName(XML_SCHEMA_URI, "dateTime", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.lang.Object",
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put("java.math.BigDecimal",
+ new QName(XML_SCHEMA_URI, "decimal", XS_URI_PREFIX));
+
+ // Any types
+ simpleXSDTypes.put(OMElement.class.getName(),
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put(ArrayList.class.getName(),
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put(Vector.class.getName(),
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ simpleXSDTypes.put(List.class.getName(),
+ new QName(XML_SCHEMA_URI, "anyType", XS_URI_PREFIX));
+ }
+
+ public QName getStdSdoType(String typename)
+ {
+ return (QName) simpleXSDTypes.get(typename);
+ }
+
+ public QName getComplexSchemaTypeName(String sdoURI, String sdoTypeName)
+ {
+ return (QName) complexXSDTypes.get(asQualifiedName(sdoURI, sdoTypeName));
+ }
+
+ public QName getComplexSchemaTypeName(JClass javaClass, ClassLoader cl) throws Exception
+ {
+ String namespace = Java2WSDLUtils.schemaNamespaceFromClassName(
+ javaClass.getQualifiedName(), cl).toString();
+ return (QName) complexXSDTypes.get(asQualifiedName(namespace, javaClass.getSimpleName()));
+ }
+
+ public boolean isSimpleType(String typeName)
+ {
+ Iterator keys = simpleXSDTypes.keySet().iterator();
+ while (keys.hasNext()) {
+ String s = (String) keys.next();
+ if (s.equals(typeName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public QName getSimpleSchemaTypeName(String typename)
+ {
+ return (QName) simpleXSDTypes.get(typename);
+ }
+
+ public void addSimpleSchemaType(String typeName, QName schemaType)
+ {
+ simpleXSDTypes.put(typeName, schemaType);
+ }
+
+
+ public void addComplexSchemaType(String namespaceURI, String name, QName schemaType)
+ {
+ complexXSDTypes.put(asQualifiedName(namespaceURI, name), schemaType);
+ }
+
+
+ public QName getQNamefortheType(String namespaceURI, String typeName)
+ {
+ if ( XML_SCHEMA_URI.equals(namespaceURI))
+ {
+ return getSimpleSchemaTypeName(typeName);
+ }
+ else
+ {
+ return getComplexSchemaTypeName(namespaceURI, typeName);
+ }
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java
new file mode 100644
index 0000000000..a742e8913d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyWSDLTypesGenerator.java
@@ -0,0 +1,373 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.generate;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaForm;
+import org.apache.ws.commons.schema.XmlSchemaImport;
+import org.apache.ws.commons.schema.XmlSchemaInclude;
+import org.apache.ws.commons.schema.XmlSchemaSequence;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.bytecode.MethodTable;
+import org.codehaus.jam.JClass;
+import org.codehaus.jam.JMethod;
+import org.codehaus.jam.JParameter;
+import org.codehaus.jam.JamClassIterator;
+import org.codehaus.jam.JamService;
+import org.codehaus.jam.JamServiceFactory;
+import org.codehaus.jam.JamServiceParams;
+
+public class TuscanyWSDLTypesGenerator implements TuscanyJava2WSDLConstants {
+ public static final String NAME_SPACE_PREFIX = "stn_";
+
+ public static final String PERIOD_SEPARATOR = ".";
+
+ private static int prefixCount = 1;
+
+ protected GenerationParameters generationParams;
+
+ protected Hashtable targetNamespacePrefixMap = new Hashtable();
+
+ protected Hashtable schemaMap = new Hashtable();
+
+ protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection();
+
+ private TuscanyTypeTable typeTable = new TuscanyTypeTable();
+
+ protected SchemaBuilder schemaBuilder = null;
+
+ protected Map schemaLocationMap = null;
+
+ private static final Log log = LogFactory.getLog(SchemaGenerator.class);
+
+ // to keep loadded method using JAM
+ private JMethod methods[];
+
+ //to store byte code method using Axis 1.x codes
+ private MethodTable methodTable;
+
+ private Class clazz;
+
+ private ArrayList excludeMethods = new ArrayList();
+
+ public TuscanyWSDLTypesGenerator(GenerationParameters genParams) throws Exception {
+ DataObjectUtil.initRuntime();
+ this.generationParams = genParams;
+
+ clazz = Class.forName(generationParams.getSourceClassName(),
+ true,
+ generationParams.getClassLoader());
+ methodTable = new MethodTable(clazz);
+
+ initializeSchemaMap(generationParams.getSchemaTargetNamespace(),
+ generationParams.getSchemaTargetNamespacePrefix());
+ schemaBuilder = new SchemaBuilder(xmlSchemaCollection,
+ schemaMap,
+ targetNamespacePrefixMap,
+ typeTable,
+ generationParams.getAttrFormDefault(),
+ generationParams.getElementFormDefault(),
+ generationParams.getSchemaLocationMap(),
+ generationParams.getClassLoader());
+ }
+
+ /**
+ * Generates schema for all the parameters in method. First generates schema
+ * for all different parameter type and later refers to them.
+ *
+ * @return Returns XmlSchema.
+ * @throws Exception
+ */
+ public Collection buildWSDLTypes() throws Exception {
+ JamServiceFactory factory = JamServiceFactory.getInstance();
+ JamServiceParams jam_service_parms = factory.createServiceParams();
+ //setting the classLoder
+// jam_service_parms.setParentClassLoader(factory.createJamClassLoader(classLoader));
+ //it can posible to add the classLoader as well
+ jam_service_parms.addClassLoader(generationParams.getClassLoader());
+ jam_service_parms.includeClass(generationParams.getSourceClassName());
+
+ for ( int count = 0 ; count < generationParams.getExtraClasses().size() ; ++count )
+ {
+ jam_service_parms.includeClass((String)generationParams.getExtraClasses().get(count));
+ }
+
+ JamService service = factory.createService(jam_service_parms);
+ QName extraSchemaTypeName = null;
+ JamClassIterator jClassIter = service.getClasses();
+ //all most all the time the ittr will have only one class in it
+ while (jClassIter.hasNext()) {
+ JClass jclass = (JClass) jClassIter.next();
+ // serviceName = jclass.getSimpleName();
+ //todo in the future , when we support annotation we can use this
+ //JAnnotation[] annotations = jclass.getAnnotations();
+
+ if ( jclass.getQualifiedName().equals(generationParams.getSourceClassName()) )
+ {
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Bean
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+ methods = jclass.getDeclaredMethods();
+ //short the elements in the array
+ Arrays.sort(methods);
+
+ // since we do not support overload
+ HashMap uniqueMethods = new HashMap();
+ XmlSchemaComplexType methodSchemaType;
+ XmlSchemaSequence sequence = null;
+
+ for (int i = 0; i < methods.length; i++) {
+ JMethod jMethod = methods[i];
+
+ String methodName = methods[i].getSimpleName();
+ // no need to think abt this method , since that is system
+ // config method
+ if (excludeMethods.contains(jMethod.getSimpleName())) {
+ continue;
+ }
+
+ if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
+ throw new Exception(
+ " Sorry we don't support methods overloading !!!! ");
+ }
+
+ if (!jMethod.isPublic()) {
+ // no need to generate Schema for non public methods
+ continue;
+ }
+ uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+ //create the schema type for the method wrapper
+
+ uniqueMethods.put(jMethod.getSimpleName(), jMethod);
+ JParameter [] paras = jMethod.getParameters();
+ String parameterNames [] = null;
+ if (paras.length > 0) {
+ parameterNames = methodTable.getParameterNames(methodName);
+ sequence = new XmlSchemaSequence();
+
+ methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
+ methodSchemaType.setParticle(sequence);
+ }
+
+ for (int j = 0; j < paras.length; j++) {
+ JParameter methodParameter = paras[j];
+ JClass paraType = methodParameter.getType();
+ generateSchemaForType(sequence, paraType,
+ (parameterNames != null && parameterNames[j] != null) ? parameterNames[j] : methodParameter.getSimpleName());
+ }
+ // for its return type
+ JClass returnType = jMethod.getReturnType();
+
+ if (!returnType.isVoidType()) {
+ methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
+ sequence = new XmlSchemaSequence();
+ methodSchemaType.setParticle(sequence);
+ generateSchemaForType(sequence, returnType, "return");
+ }
+ }
+ }
+ else
+ {
+ //generate the schema type for extra classes
+ extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(jclass.getQualifiedName());
+ if (extraSchemaTypeName == null)
+ {
+ extraSchemaTypeName = schemaBuilder.generateSchema(jclass);
+ }
+ }
+ }
+ return schemaMap.values();
+ }
+
+ private QName generateSchemaForType(XmlSchemaSequence sequence, JClass type, String partName) throws Exception {
+ boolean isArrayType = type.isArrayType();
+ if (isArrayType) {
+ type = type.getArrayComponentType();
+ }
+
+ String classTypeName = type.getQualifiedName();
+
+ QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName);
+ if (schemaTypeName == null) {
+ schemaTypeName = schemaBuilder.generateSchema(type);
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ type.isArrayType());
+ addImportORInclude((XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace()),
+ schemaTypeName);
+
+ } else {
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ type.isArrayType());
+ }
+
+ return schemaTypeName;
+ }
+
+ private void addContentToMethodSchemaType(XmlSchemaSequence sequence,
+ QName schemaTypeName,
+ String paraName,
+ boolean isArray) {
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(paraName);
+ elt1.setSchemaTypeName(schemaTypeName);
+ sequence.getItems().add(elt1);
+
+ if (isArray) {
+ elt1.setMaxOccurs(Long.MAX_VALUE);
+ elt1.setMinOccurs(0);
+ }
+ }
+
+ private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) throws Exception {
+ XmlSchema xmlSchema = (XmlSchema) schemaMap.get(generationParams.getSchemaTargetNamespace());
+ QName elementName = new QName(generationParams.getSchemaTargetNamespace(),
+ localPartName,
+ generationParams.getSchemaTargetNamespacePrefix());
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+
+ XmlSchemaElement globalElement = new XmlSchemaElement();
+ globalElement.setSchemaType(complexType);
+ globalElement.setName(formGlobalElementName(localPartName));
+ globalElement.setQName(elementName);
+
+ xmlSchema.getItems().add(globalElement);
+ xmlSchema.getElements().add(elementName,
+ globalElement);
+
+ typeTable.addComplexSchemaType(generationParams.getSchemaTargetNamespace(),
+ globalElement.getName(),
+ elementName);
+
+ return complexType;
+ }
+
+ private String formGlobalElementName(String typeName) {
+ String firstChar = typeName.substring(0,
+ 1);
+ return typeName.replaceFirst(firstChar,
+ firstChar.toLowerCase());
+ }
+
+ public TuscanyTypeTable getTypeTable() {
+ return typeTable;
+ }
+
+ public JMethod[] getMethods() {
+ return methods;
+ }
+
+ private String generatePrefix() {
+ return NAME_SPACE_PREFIX + prefixCount++;
+ }
+
+ public void setExcludeMethods(ArrayList excludeMethods) {
+ this.excludeMethods = excludeMethods;
+ }
+
+ private void initializeSchemaMap(String targetNamespace, String targetNamespacePrefix) {
+ XmlSchema xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection);
+ xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting());
+ xmlSchema.setElementFormDefault(getElementFormDefaultSetting());
+
+ targetNamespacePrefixMap.put(targetNamespace,
+ targetNamespacePrefix);
+ schemaMap.put(targetNamespace,
+ xmlSchema);
+
+ NamespaceMap prefixmap = new NamespaceMap();
+ prefixmap.put(TuscanyTypeTable.XS_URI_PREFIX,
+ TuscanyTypeTable.XML_SCHEMA_URI);
+ prefixmap.put(targetNamespacePrefix,
+ targetNamespace);
+ xmlSchema.setNamespaceContext(prefixmap);
+ }
+
+
+ private void addImportORInclude(XmlSchema xmlSchema, QName schemaTypeName) {
+ //decide whether there must be an import or an include
+ if (xmlSchema.getTargetNamespace().equals(schemaTypeName.getNamespaceURI())) {
+ XmlSchema containingSchema = (XmlSchema) schemaMap.get(schemaTypeName.getNamespaceURI());
+ //if the type is not defined in the Schema then include
+ if (containingSchema.getTypeByName(schemaTypeName) == null) {
+ String schemaLocation = null;
+ if ((schemaLocation = (String) schemaLocationMap.get(schemaTypeName.getNamespaceURI())) != null) {
+ schemaLocation = DEFAULT_SCHEMA_LOCATION;
+ }
+
+ XmlSchemaInclude includeElement = new XmlSchemaInclude();
+ includeElement.setSchemaLocation(schemaLocation);
+
+ if (!xmlSchema.getIncludes().contains(includeElement)) {
+ xmlSchema.getIncludes().add(includeElement);
+ }
+ }
+ } else {
+ if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values()
+ .contains(schemaTypeName.getNamespaceURI())) {
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(schemaTypeName.getNamespaceURI());
+ xmlSchema.getItems().add(importElement);
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).put(generatePrefix(),
+ schemaTypeName.getNamespaceURI());
+ }
+ }
+ }
+
+ private XmlSchemaForm getAttrFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getAttrFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ private XmlSchemaForm getElementFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(generationParams.getElementFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.java
new file mode 100644
index 0000000000..26b3d092de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenEvent.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.tools.java2wsdl.generate;
+
+import java.util.EventObject;
+
+public class WSDLGenEvent extends EventObject {
+ private int generationPhase = WSDLGenListener.UNKNOWN;
+
+ public WSDLGenEvent(Object source, int genPhase) {
+ super(source);
+ this.generationPhase = genPhase;
+ }
+
+ public int getGenerationPhase() {
+ return generationPhase;
+ }
+
+ public void setGenerationPhase(int generationPhase) {
+ this.generationPhase = generationPhase;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.java
new file mode 100644
index 0000000000..788d162f34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/generate/WSDLGenListener.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.tools.java2wsdl.generate;
+
+public interface WSDLGenListener {
+ public static int UNKNOWN = 0;
+
+ public static int INPUT_ARGS_PARSING = 1;
+
+ public static int INPUT_ARGS_VALIDATION = 2;
+
+ public static int WSDL_MODEL_CREATION = 3;
+
+ public static int WSDL_MODEL_WRITING = 4;
+
+ public static String[] phaseAsString = { "Unknown",
+ "Input Arguments Parsing", "Input Arguments Validation",
+ "WSDL Model Creation", "WSDL Model Writing" };
+
+ public void WSDLGenPhaseStarted(WSDLGenEvent event);
+
+ public void WSDLGenPhaseCompleted(WSDLGenEvent event);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.java
new file mode 100644
index 0000000000..b30b8cd62b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/util/XMLNameUtil.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.tools.java2wsdl.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class XMLNameUtil {
+
+ /**
+ * Returns a valid Java name from an XML Name.
+ *
+ * @param name
+ * @param isUpperCase
+ * @return a valid Java name from an XML Name
+ */
+ public static String getJavaNameFromXMLName(String name, boolean isUpperCase) {
+ List<String> parsedName = parseName(name, '_');
+ StringBuilder result = new StringBuilder(64 * parsedName.size());
+ for (String nameComponent: parsedName) {
+ if (nameComponent.length() > 0) {
+ if (result.length() > 0 || isUpperCase) {
+ result.append(Character.toUpperCase(nameComponent.charAt(0)));
+ result.append(nameComponent.substring(1));
+ } else {
+ result.append(nameComponent);
+ }
+ }
+ }
+
+ if (result.length() == 0) {
+ return "_";
+ }
+ if (Character.isJavaIdentifierStart(result.charAt(0))) {
+ return isUpperCase ? result.toString() : decapitalizeName(result.toString());
+ }
+ return "_" + result;
+ }
+
+ /**
+ * Decapitalize a name.
+ * @param name
+ * @return a decapitalized name
+ */
+ public static String decapitalizeName(String name) {
+ if (name.length() == 0) {
+ return name;
+ } else {
+ String lowerName = name.toLowerCase();
+ int i;
+ for (i = 0; i < name.length(); i++) {
+ if (name.charAt(i) == lowerName.charAt(i)) {
+ break;
+ }
+ }
+ if (i > 1 && i < name.length()) {
+ --i;
+ }
+ return name.substring(0, i).toLowerCase() + name.substring(i);
+ }
+ }
+
+ /**
+ * Parse the given name.
+ *
+ * @param sourceName
+ * @param separator
+ * @return some stuff parsed from the name
+ */
+ private static List<String> parseName(String sourceName, char separator) {
+ List<String> result = new ArrayList<String>();
+ if (sourceName != null) {
+ StringBuilder currentWord = new StringBuilder(64);
+ boolean lastIsLower = false;
+ int index;
+ int length;
+ for (index = 0, length = sourceName.length(); index < length; ++index) {
+ char curChar = sourceName.charAt(index);
+ if (!Character.isJavaIdentifierPart(curChar)) {
+ curChar = separator;
+ }
+ if (Character.isUpperCase(curChar)
+ || (!lastIsLower && Character.isDigit(curChar))
+ || curChar == separator) {
+
+ if (lastIsLower && currentWord.length() > 1
+ || curChar == separator && currentWord.length() > 0) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ }
+ lastIsLower = false;
+ } else {
+ if (!lastIsLower) {
+ int currentWordLength = currentWord.length();
+ if (currentWordLength > 1) {
+ char lastChar = currentWord.charAt(--currentWordLength);
+ currentWord.setLength(currentWordLength);
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ currentWord.append(lastChar);
+ }
+ }
+ lastIsLower = true;
+ }
+
+ if (curChar != separator) {
+ currentWord.append(curChar);
+ }
+ }
+
+ result.add(currentWord.toString());
+ }
+ return result;
+ }
+
+ /**
+ * Return an EPackage name for the given namespace.
+ *
+ * @param namespace
+ * @return an EPackage name for the given namespace
+ */
+ public static String getPackageNameFromNamespace(String namespace) {
+ return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/NOTICE
@@ -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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/META-INF/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl
new file mode 100644
index 0000000000..e3da5da20f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/main/resources/RemotableInterfaceTemplate.xsl
@@ -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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+
+ <!-- import the databinding template-->
+ <xsl:include href="databindsupporter"/>
+ <!-- import the other templates for databinding
+ Note - these names would be handled by a special
+ URI resolver during the xslt transformations
+ -->
+ <xsl:include href="externalTemplate"/>
+
+
+ <xsl:template match="/interface">
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+
+ /**
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+ package <xsl:value-of select="$package"/>;
+
+ import org.osoa.sca.annotations.Remotable;
+ import org.apache.tuscany.api.annotation.DataType;
+
+ /*
+ * <xsl:value-of select="@name"/> java interface
+ */
+
+ @Remotable
+ @DataType(name="commonj.sdo.DataObject")
+ public interface <xsl:value-of select="@name"></xsl:value-of> {
+ <xsl:for-each select="method">
+ <!-- Code for in-out mep -->
+ <xsl:if test="@mep='12'">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+ <!-- start of the sync block -->
+ <xsl:if test="$isSync='1'">
+ /**
+ * Auto generated method signatures
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ */
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+ <!-- end of the sync block -->
+ </xsl:if>
+
+ <!-- start of the async block -->
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param"><xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ */
+
+ public void start<xsl:value-of select="@name"/>(
+ <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
+ </xsl:if>
+<!-- end of async block-->
+
+ </xsl:if>
+ <!-- Code for in-only mep -->
+ <xsl:if test="@mep='10'">
+
+ <!-- For in-only meps there would not be any asynchronous methods since there is no output -->
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+ </xsl:text></xsl:if></xsl:for-each>
+ */
+ public void
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:if>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- Apply other templates -->
+ //<xsl:apply-templates/>
+ }
+
+
+ </xsl:template>
+ </xsl:stylesheet> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.java
new file mode 100644
index 0000000000..e679496509
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerValue.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.tools.java2wsdl.generate;
+
+import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer;
+
+public class CustomerValue {
+
+ public int getValue(String custId, String stockSymbol) {
+ return 0;
+ }
+
+ public Customer getCustomerDetails(String custId) {
+ return new Customer();
+ }
+
+ public String noArgsServiceMethod()
+ {
+ return new String();
+ }
+
+ private void privateServiceMethod()
+ {
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.java
new file mode 100644
index 0000000000..4b5a795f2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/CustomerWithAccount.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.tools.java2wsdl.generate;
+
+import org.apache.tuscany.tools.java2wsdl.generate.account.Account;
+import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer;
+
+public class CustomerWithAccount {
+
+ private Customer customer = new Customer();
+
+ private Account[] accounts;
+
+ public int getValue(String custId, String stockSymbol) {
+ return 123;
+ }
+
+ public Customer getCustomerDetails(String custId) {
+ return customer;
+ }
+
+ public Account getCustomerAccount(String custId, String accountId) {
+ return accounts[0];
+ }
+
+ public Account[] getAccounts() {
+ return accounts;
+ }
+
+ public void setAccounts(Account[] accounts) {
+ this.accounts = accounts;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.java
new file mode 100644
index 0000000000..a72321c9b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/TuscanyJava2WSDLTestCase.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.tools.java2wsdl.generate;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * A JUnit test case to test the Tuscany Java 2 WSDL Generation
+ */
+public class TuscanyJava2WSDLTestCase extends TestCase {
+
+ /**
+ * setup the pre-requisites for the test case to run
+ *
+ * @exception Exception
+ */
+ protected void setUp() throws Exception {
+ // System.out.println("inside setup");
+ super.setUp();
+ }
+
+ /**
+ * @exception Exception
+ */
+ protected void tearDown() throws Exception {
+ // System.out.println("inside tearDown");
+ super.tearDown();
+ }
+
+
+ /**
+ * Simple WSDL generation test.
+ */
+ public void testSimpleWSDLGeneration() {
+ String[] arguments = new String[] { "-cn","org.apache.tuscany.tools.java2wsdl.generate.CustomerValue",
+ "-o", "target/java2wsdl-source",
+ "-xc", "org.apache.tuscany.tools.java2wsdl.generate.extra.GoldCustomer"};
+
+
+ Java2WSDL.main(arguments);
+
+ File file = new File("target/java2wsdl-source/CustomerValue.wsdl");
+ assertTrue(file.exists() && file.isFile());
+ }
+
+ /**
+ * Test WSDL generation where a parameter Object[] is involved.
+ */
+ public void testWsdlGeneration2() {
+
+ String[] arguments = new String[]
+ {
+ "-cn",
+ "org.apache.tuscany.tools.java2wsdl.generate.CustomerWithAccount",
+ "-o", "target/java2wsdl-source", };
+ Java2WSDL.main(arguments);
+
+ File file = new File("target/java2wsdl-source/CustomerWithAccount.wsdl");
+ assertTrue(file.exists() && file.isFile());
+ }
+
+ public void testWsdlGeneration_SDO_Static()
+ {
+ //tests for SDOs where XSD exist. Hence no XSDs must be generated
+ String[] arguments = new String[] {
+ "-cn",
+ "org.soapinterop.CreditScoreDocLit",
+ "-o", "target/java2wsdl-source",
+ "-ixsd", "[http://www.example.org/creditscore/doclit/," +
+ "http://www.example.org/creditscore/doclit/xsd]"};
+ Java2WSDL.main(arguments);
+
+ File file = new File("target/java2wsdl-source/CreditScoreDocLit.wsdl");
+ assertTrue(file.exists() && file.isFile());
+ }
+
+
+
+ /**
+ * Test WSDL generation from a java interface and then generate the java
+ * interface using the generated WSDL.
+ */
+ public void _testRoundTrip() {
+ // TODO implement round trip
+ // this should re-generate java interfaces from the generated wsdl
+ // and compile (?) the generated java code.
+ // fail();
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.java
new file mode 100644
index 0000000000..84d59164ee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/account/Account.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.tools.java2wsdl.generate.account;
+
+import java.math.BigDecimal;
+
+public class Account {
+ int accountType;
+
+ String accountNo;
+
+ BigDecimal balance;
+
+ public String getAccountNo() {
+ return accountNo;
+ }
+
+ public void setAccountNo(String accountNo) {
+ this.accountNo = accountNo;
+ }
+
+ public int getAccountType() {
+ return accountType;
+ }
+
+ public void setAccountType(int accountType) {
+ this.accountType = accountType;
+ }
+
+ public BigDecimal getBalance() {
+ return balance;
+ }
+
+ public void setBalance(BigDecimal balance) {
+ this.balance = balance;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.java
new file mode 100644
index 0000000000..a28399e7fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/customer/Customer.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.tools.java2wsdl.generate.customer;
+
+public class Customer {
+ private String name = "";
+
+ public int custType = 0;
+
+ public String getName() {
+ return name;
+ }
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.java
new file mode 100644
index 0000000000..afc68a3217
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/apache/tuscany/tools/java2wsdl/generate/extra/GoldCustomer.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.tools.java2wsdl.generate.extra;
+
+import org.apache.tuscany.tools.java2wsdl.generate.customer.Customer;
+
+
+
+
+public class GoldCustomer extends Customer {
+ public String goldCustNumber = "";
+
+ public String getGoldCustNumber() {
+ return goldCustNumber;
+ }
+
+ public void setGoldCustNumber(String goldCustNumber) {
+ this.goldCustNumber = goldCustNumber;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.java
new file mode 100644
index 0000000000..e9e8aa882a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/java/org/soapinterop/CreditScoreDocLit.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.soapinterop;
+
+public interface CreditScoreDocLit {
+ public org.example.creditscore.doclit.CreditReport getCreditScore(
+ org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException;
+ }
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..e7be3ce5ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl
new file mode 100644
index 0000000000..09d1a58589
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/CreditScoreDocLit.wsdl
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclit/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
+ <xsd:complexType name="CreditReport">
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScoreRequest"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLit">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitSOAP"
+ name="CreditScoreDocLitSOAP">
+ <soap:address location="http://www.example.org/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/helloworld.wsdl
new file mode 100644
index 0000000000..051f604bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/helloworld.wsdl
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ xmlns:hello="http://helloworldaxis.samples.tuscany.apache.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="ComplexGreetings">
+ <sequence>
+ <element name="greet1" type="xsd:string"/>
+ <element name="greet2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ <element name="in1" type="xsd:double"/>
+ <element name="in2" type="hello:ComplexGreetings"/>
+ </sequence>
+ <xsd:attribute name="language" type="xsd:string"/>
+ </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="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <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="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service -->
+<!--
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+-->
+ <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ <!-- Axis Web Service -->
+ <!--
+ <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc-incubating-M1/services/helloworld"/>
+ -->
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/sequences.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/src/test/resources/sequences.xsd
new file mode 100644
index 0000000000..a565f3fa65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/pom.xml
new file mode 100644
index 0000000000..5ddfa360b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/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-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-java2wsdl</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Maven Plugin for Java2WSDL</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-java2wsdl</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java
new file mode 100644
index 0000000000..a5f6158dcd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-java2wsdl/src/main/java/org/apache/tuscany/tools/java2wsdl/plugin/Java2WSDLGeneratorMojo.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.java2wsdl.plugin;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.tuscany.tools.java2wsdl.generate.Java2WSDLGeneratorFactory;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal generate
+ * @phase generate-sources
+ * @description Generate WSDL from a given Java class / interface
+ */
+public class Java2WSDLGeneratorMojo extends AbstractMojo
+{
+
+ /**
+ * The name of the class for which the WSDL must be generated
+ * @parameter
+ *
+ */
+ private String sourceClassName;
+
+ /**
+ * The location where the wsdls should be generated into
+ * @parameter expression="${project.build.directory}\\java2wsdl-wsdl"
+ */
+ private String targetLocation;
+
+ /**
+ * The name of the wsdl file
+ * @parameter
+ */
+ private String wsdlFilename;
+
+
+ /**
+ * Classpaths to be included
+ * @parameter
+ *
+ */
+ String[] classpaths;
+
+ /**
+ * The name of the service
+ * @parameter
+ */
+ private String serviceName;
+
+ /**
+ * The binding style for the service
+ * @parameter
+ */
+ private String bindingStyle;
+
+ /**
+ * The binding use option
+ * @parameter
+ */
+ private String bindingUse;
+
+ /**
+ * The soap address
+ * @parameter
+ */
+ private String soapAddress;
+
+ public void execute() throws MojoExecutionException
+ {
+ try
+ {
+ Java2WSDLGeneratorFactory.getInstance().createGenerator().generateWSDL(createOptionsMap ());
+ }
+ catch ( Exception e )
+ {
+ throw new MojoExecutionException("Exception in Java2WSDL Maven Plugin ", e);
+ }
+ }
+
+ protected Map createOptionsMap()
+ {
+ Map optionsMap = new Hashtable();
+
+ optionsMap.put(Java2WSDLConstants.CLASSNAME_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSNAME_OPTION, new String[]{sourceClassName}));
+
+ if ( targetLocation != null )
+ {
+ optionsMap.put(Java2WSDLConstants.OUTPUT_LOCATION_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_LOCATION_OPTION, new String[]{targetLocation}));
+ }
+
+ if ( wsdlFilename != null )
+ {
+ optionsMap.put(Java2WSDLConstants.OUTPUT_FILENAME_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.OUTPUT_FILENAME_OPTION, new String[]{wsdlFilename}));
+ }
+
+ if ( classpaths != null && classpaths.length > 0 )
+ {
+ optionsMap.put(Java2WSDLConstants.CLASSPATH_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.CLASSPATH_OPTION, classpaths));
+ }
+
+ if ( serviceName != null )
+ {
+ optionsMap.put(Java2WSDLConstants.SERVICE_NAME_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.SERVICE_NAME_OPTION, new String[]{serviceName}));
+ }
+
+ if ( bindingStyle != null )
+ {
+ optionsMap.put(Java2WSDLConstants.STYLE_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.STYLE_OPTION, new String[]{bindingStyle}));
+ }
+
+ if ( bindingUse != null )
+ {
+ optionsMap.put(Java2WSDLConstants.USE_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.USE_OPTION, new String[]{bindingUse}));
+ }
+
+ if ( soapAddress != null )
+ {
+ optionsMap.put(Java2WSDLConstants.LOCATION_OPTION,
+ new Java2WSDLCommandLineOption(Java2WSDLConstants.LOCATION_OPTION, new String[]{soapAddress}));
+ }
+
+ return optionsMap;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/pom.xml
new file mode 100644
index 0000000000..beac0727b3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/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-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-maven-wsdl2java</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Apache Tuscany Maven Plugin for WSDL2Java</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.java
new file mode 100644
index 0000000000..2d08c31326
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDL2JavaGeneratorMojo.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.tools.wsdl2java.plugin;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator;
+
+/**
+ * @version $Rev$ $Date$
+ * @goal generate
+ * @phase generate-sources
+ * @description Generate SDO interface classes from an XML Schema
+ */
+public class WSDL2JavaGeneratorMojo extends AbstractMojo {
+ /**
+ * The directory containing wsdl files; defaults to ${basedir}/src/main/wsdl
+ * @parameter expression="${basedir}/src/main/wsdl"
+ */
+ private String wsdlDir;
+
+ /**
+ * Name of the wsdl file; if omitted all files in the directory are processed
+ * @parameter
+ */
+ private File wsdlFile;
+
+ /**
+ * The Java package to generate into. By default the value is derived from the schema URI.
+ *
+ * @parameter
+ */
+ private String javaPackage;
+
+ /**
+ * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source
+ *
+ * @parameter expression="${project.build.directory}/wsdl2java-source"
+ */
+ private String targetDirectory;
+
+ /**
+ * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source
+ *
+ * @parameter
+ */
+ private WSDLFileOption[] wsdlFiles;
+
+ /**
+ * @parameter expression="${project.compileSourceRoots}"
+ * @readonly
+ */
+ private List compilerSourceRoots;
+
+ public void execute() throws MojoExecutionException {
+
+ if(null != wsdlFiles){
+ for(int i=0; i< wsdlFiles.length ; ++i ){
+ System.err.println("wsdlFiles" + wsdlFiles[i].getFileName());
+ WSDLFileOption wf = wsdlFiles[i];
+
+ if(null == wf.getTargetDirectory())
+ wf.setTargetDirectory(targetDirectory);
+ if(null == wf.getJavaPackage()){
+ wf.setJavaPackage(javaPackage);
+ }
+ if(wf.getFileName() == null || wf.getFileName().length() ==0){
+ throw new MojoExecutionException("no fileName specfied for wsdl.");
+ }
+ if(!wf.getFileName().canRead() || !wf.getFileName().isFile()){
+
+ throw new MojoExecutionException("file can not be read:"+wf.getFileName());
+ }
+
+ }
+ }else{
+
+
+
+ if (wsdlFile == null) {
+
+ File[] files = new File(wsdlDir).listFiles(FILTER);
+
+ wsdlFiles= new WSDLFileOption[files.length];
+ for(int i= files.length -1; i> -1; --i){
+
+
+ wsdlFiles[i] = new WSDLFileOption();
+ wsdlFiles[i].setFileName(files[i]);
+ wsdlFiles[i].setJavaPackage(javaPackage);
+ wsdlFiles[i].setPorts(null);
+ wsdlFiles[i].setTargetDirectory(targetDirectory);
+
+
+ }
+
+ } else {
+ wsdlFiles= new WSDLFileOption[]{new WSDLFileOption()};
+ wsdlFiles[0].setFileName(wsdlFile);
+ wsdlFiles[0].setJavaPackage(javaPackage);
+ wsdlFiles[0].setPorts(null);
+ wsdlFiles[0].setTargetDirectory(targetDirectory);
+ }
+ }
+
+ int genOptions = 0;
+
+ for (int i = 0; i < wsdlFiles.length; i++) {
+ File file = wsdlFiles[i].getFileName();
+ File marker = new File(targetDirectory, ".gen#" + file.getName()+".wsdl2java");
+ if (file.lastModified() > marker.lastModified()) {
+ getLog().info("Generating Java service interfaces from " + file);
+ WSDL2JavaGenerator.generateFromWSDL(file.toString(), wsdlFiles[i].getPorts(), wsdlFiles[i].getTargetDirectory(), wsdlFiles[i].getJavaPackage(), null, genOptions);
+ }
+ try {
+ marker.createNewFile();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e.getMessage(), e);
+ }
+ marker.setLastModified(System.currentTimeMillis());
+ }
+
+ compilerSourceRoots.add(targetDirectory);
+ }
+
+ private static final FileFilter FILTER = new FileFilter() {
+ public boolean accept(File pathname) {
+ return (pathname.isFile() || !pathname.isHidden());
+ }
+ };
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.java
new file mode 100644
index 0000000000..3e6ebf0acc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/maven-wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/plugin/WSDLFileOption.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.tools.wsdl2java.plugin;
+
+import java.io.File;
+
+public class WSDLFileOption {
+ /**
+ * Name of the wsdl file; if omitted all files in the directory are processed
+ *
+ */
+ private File fileName;
+
+ /**
+ * The Java package to generate into. By default the value is derived from the schema URI.
+ *
+ *
+ */
+ private String javaPackage;
+
+ /**
+ * The directory to generate into; defaults to ${project.build.directory}/wsdl2java-source
+ *
+ *
+ */
+ private String targetDirectory;
+
+ /**
+ * @parameter expression="${project.compileSourceRoots}"
+ * @readonly
+ */
+
+ private String ports[];
+
+ /**
+ * @parameter expression="${project.compileSourceRoots}"
+ * @readonly
+ */
+
+
+ public WSDLFileOption(){}
+
+ public String getJavaPackage() {
+ return javaPackage;
+ }
+
+ public void setJavaPackage(String javaPackage) {
+ this.javaPackage = javaPackage;
+ }
+
+
+ public String[] getPorts() {
+ return ports;
+ }
+
+ public void setPorts(String[] ports) {
+ this.ports = ports;
+ }
+
+ public String getTargetDirectory() {
+ return targetDirectory;
+ }
+
+ public void setTargetDirectory(String targetDirectory) {
+ this.targetDirectory = targetDirectory;
+ }
+
+ public File getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(File fileName) {
+ this.fileName = fileName;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/policy/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/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/sca-java-1.x/branches/sca-java-0.90/modules/policy/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/policy/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/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/sca-java-1.x/branches/sca-java-0.90/modules/policy/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/policy/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/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/sca-java-1.x/branches/sca-java-0.90/modules/policy/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/policy/pom.xml
new file mode 100644
index 0000000000..1baa756868
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/pom.xml
@@ -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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-policy</artifactId>
+ <name>Apache Tuscany Policy Model</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java
new file mode 100644
index 0000000000..2da41675a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.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.policy;
+
+import org.apache.tuscany.sca.policy.impl.PolicyFactoryImpl;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultPolicyFactory extends PolicyFactoryImpl implements PolicyFactory {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
new file mode 100644
index 0000000000..de975cb2d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.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.sca.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Represents a policy intent. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface Intent {
+
+ /**
+ * Returns the intent name.
+ *
+ * @return the intent name
+ */
+ QName getName();
+
+ /**
+ * Sets the intent name
+ *
+ * @param name the intent name
+ */
+ void setName(QName name);
+
+ /**
+ * Returns the list of operations that this intent applies to.
+ *
+ * @return
+ */
+ List<Operation> getOperations();
+
+ /**
+ * Returns the list of SCA constructs that this intent is meant to
+ * configure.
+ *
+ * @return the list of SCA constructs that this intent is meant to configure
+ */
+ List<QName> getConstrains();
+
+ /**
+ * Returns the list of required intents.
+ *
+ * @return
+ */
+ List<Intent> getRequiredIntents();
+
+ /**
+ * Returns the list of children qualified intents.
+ *
+ * @return the list of children qualified intents.
+ */
+ List<Intent> getQualifiedIntents();
+
+ /**
+ * Returns the intent description.
+ *
+ * @return the intent description
+ */
+ String getDescription();
+
+ /**
+ * Sets the intent description.
+ *
+ * @param description the intent description
+ */
+ void setDescription(String description);
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java
new file mode 100644
index 0000000000..b7e430094e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can be have policy intents
+ * attached to them.
+ */
+public interface IntentAttachPoint {
+
+ /**
+ * Returns a list of policy intents. See the Policy Framework specification
+ * for a description of this attribute.
+ *
+ * @return a list of policy intents.
+ */
+ List<Intent> getRequiredIntents();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
new file mode 100644
index 0000000000..9dd0be314b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.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.sca.policy;
+
+import java.util.List;
+
+/**
+ * Represents a policy intent map. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface IntentMap {
+
+ /**
+ * Returns the intent realized by this intent map.
+ *
+ * @return the intent realized by this intent map
+ */
+ Intent getProvidedIntent();
+
+ /**
+ * Sets the intent realized by this intent map.
+ *
+ * @param providedIntent the intent realized by this intent map
+ */
+ void setProvidedIntent(Intent providedIntent);
+
+ /**
+ * Returns the default qualified intent map.
+ *
+ * @return the default qualified intent map
+ */
+ IntentMap getDefaultQualifiedIntentMap();
+
+ /**
+ * Sets the default qualified intent map.
+ *
+ * @param defaultQualifiedIntentMap the default qualified intent map
+ */
+ void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap);
+
+ /**
+ * Returns the list of children qualified intent maps.
+ *
+ * @return
+ */
+ List<IntentMap> getQualifiedIntentMaps();
+
+ /**
+ * Returns the list of concrete policies, either WS-Policy policy
+ * attachments, policy references, or policies expressed in another policy
+ * language.
+ *
+ * @return the list of concrete policies
+ */
+ List<Object> getPolicies();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
new file mode 100644
index 0000000000..97818a0d63
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.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.policy;
+
+/**
+ * A factory for the policy model.
+ */
+public interface PolicyFactory {
+
+ /**
+ * Create a new intent.
+ *
+ * @return a new intent
+ */
+ Intent createIntent();
+
+ /**
+ * Create a new policy set.
+ *
+ * @return a new policy set
+ */
+ PolicySet createPolicySet();
+
+ /**
+ * Create a new intent map.
+ *
+ * @return a new intent map
+ */
+ IntentMap createIntentMap();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
new file mode 100644
index 0000000000..9413cbef78
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.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.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+/**
+ * Represents a policy set. See the Policy Framework specification for a
+ * description of this element.
+ */
+public interface PolicySet {
+
+ /**
+ * Returns the intent name.
+ *
+ * @return the intent name
+ */
+ QName getName();
+
+ /**
+ * Sets the intent name
+ *
+ * @param name the intent name
+ */
+ void setName(QName name);
+
+ /**
+ * Returns the list of operations that this policy set applies to.
+ *
+ * @return
+ */
+ List<Operation> getOperations();
+
+ /**
+ * Returns the list of
+ *
+ * @return
+ */
+ List<PolicySet> getReferencedPolicySets();
+
+ /**
+ * Returns the list of provided intents
+ *
+ * @return
+ */
+ List<Intent> getProvidedIntents();
+
+ /**
+ * Returns the list of SCA constructs that this policy set is meant to
+ * configure.
+ *
+ * @return the list of SCA constructs that this policy set is meant to
+ * configure
+ */
+ List<QName> getAppliesTo();
+
+ /**
+ * Returns the list of concrete policies, either WS-Policy policy
+ * attachments, policy references, or policies expressed in another policy
+ * language.
+ *
+ * @return the list of concrete policies
+ */
+ List<Object> getPolicies();
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ boolean isUnresolved();
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ void setUnresolved(boolean unresolved);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java
new file mode 100644
index 0000000000..42e6fab199
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.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.policy;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can have policy sets
+ * attached to them.
+ */
+public interface PolicySetAttachPoint extends IntentAttachPoint {
+
+ /**
+ * Returns a list of policy sets. See the Policy Framework specification for
+ * a description of this attribute.
+ *
+ * @return a list of policy sets.
+ */
+ List<PolicySet> getPolicySets();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
new file mode 100644
index 0000000000..a41b18b056
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.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.sca.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.Intent;
+
+/**
+ * Represents a policy intent.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentImpl implements Intent {
+
+ private QName name;
+ private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> constrains;
+ private String description;
+ private List<Intent> qualifiedIntents;
+ private List<Intent> requiredIntents;
+ private boolean unresolved;
+
+ protected IntentImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public List<QName> getConstrains() {
+ return constrains;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<Intent> getQualifiedIntents() {
+ return qualifiedIntents;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java
new file mode 100644
index 0000000000..aab03281ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.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.policy.impl;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+
+/**
+ * Represents an intent map.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMapImpl implements IntentMap {
+
+ private boolean unresolved;
+ private IntentMap defaultQualifiedIntentMap;
+ private List<Object> policies;
+ private Intent providedIntent;
+ private List<IntentMap> qualifiedIntentMaps;
+
+ protected IntentMapImpl() {
+ }
+
+ public IntentMap getDefaultQualifiedIntentMap() {
+ return defaultQualifiedIntentMap;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ public Intent getProvidedIntent() {
+ return providedIntent;
+ }
+
+ public List<IntentMap> getQualifiedIntentMaps() {
+ return qualifiedIntentMaps;
+ }
+
+ public void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap) {
+ this.defaultQualifiedIntentMap = defaultQualifiedIntentMap;
+ }
+
+ public void setProvidedIntent(Intent providedIntent) {
+ this.providedIntent = providedIntent;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
new file mode 100644
index 0000000000..07a539e471
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.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.policy.impl;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentMap;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * A factory for the policy model.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class PolicyFactoryImpl implements PolicyFactory {
+
+ public Intent createIntent() {
+ return new IntentImpl();
+ }
+
+ public PolicySet createPolicySet() {
+ return new PolicySetImpl();
+ }
+
+ public IntentMap createIntentMap() {
+ return new IntentMapImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
new file mode 100644
index 0000000000..80a7af5de5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.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.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+/**
+ * Represents a policy set.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicySetImpl implements PolicySet {
+
+ private QName name;
+ private List<Operation> operations = new ArrayList<Operation>();
+ private List<QName> appliesTo;
+ private List<Intent> providedIntents;
+ private List<PolicySet> referencedPolicySets;
+ private List<Object> policies;
+ private boolean unresolved;
+
+ protected PolicySetImpl() {
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public List<Operation> getOperations() {
+ return operations;
+ }
+
+ public List<QName> getAppliesTo() {
+ return appliesTo;
+ }
+
+ public List<Intent> getProvidedIntents() {
+ return providedIntents;
+ }
+
+ public List<PolicySet> getReferencedPolicySets() {
+ return referencedPolicySets;
+ }
+
+ public List<Object> getPolicies() {
+ return policies;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java
new file mode 100644
index 0000000000..6732ca238d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.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.sca.policy;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+/**
+ * Test building of policy model instances using the policy factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PolicyFactoryTestCase extends TestCase {
+
+ PolicyFactory factory;
+
+ public void setUp() throws Exception {
+ factory = new DefaultPolicyFactory();
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ }
+
+ public void testCreateIntent() {
+ Intent intent = factory.createIntent();
+ intent.setName(new QName("http://test", "reliability"));
+ assertEquals(intent.getName(), new QName("http://test", "reliability"));
+ }
+
+ public void testCreatePolicySet() {
+ PolicySet policySet = factory.createPolicySet();
+ policySet.setName(new QName("http://test", "reliability"));
+ assertEquals(policySet.getName(), new QName("http://test", "reliability"));
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/pom.xml
new file mode 100644
index 0000000000..1933187798
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-modules</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Modules</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>assembly</module>
+ <module>assembly-java-dsl</module>
+ <module>assembly-xml</module>
+ <module>binding-jsonrpc</module>
+ <module>binding-rmi</module>
+ <module>binding-ws</module>
+ <module>binding-ws-axis2</module>
+ <module>binding-ws-xml</module>
+ <module>commonj-api</module>
+ <module>contribution</module>
+ <module>contribution-impl</module>
+ <module>core</module>
+ <module>core-databinding</module>
+ <module>core-spi</module>
+ <module>core-spring</module>
+ <module>databinding</module>
+ <module>databinding-axiom</module>
+ <module>databinding-jaxb</module>
+ <module>databinding-sdo</module>
+ <module>databinding-sdo-axiom</module>
+ <module>host-embedded</module>
+ <module>host-http</module>
+ <module>host-webapp</module>
+ <module>http-jetty</module>
+ <module>http-tomcat</module>
+ <module>interface</module>
+ <module>interface-java</module>
+ <module>interface-java-xml</module>
+ <module>interface-java-runtime</module>
+ <module>interface-wsdl</module>
+ <module>interface-wsdl-xml</module>
+ <module>interface-wsdl-runtime</module>
+ <module>implementation-java</module>
+ <module>implementation-java-xml</module>
+ <module>implementation-java-runtime</module>
+ <module>implementation-script</module>
+ <module>java2wsdl</module>
+ <module>maven-java2wsdl</module>
+ <module>maven-wsdl2java</module>
+ <module>policy</module>
+ <module>host-rmi</module>
+ <module>sca-api</module>
+ <module>wsdl2java</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/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/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/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/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/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/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/pom.xml
new file mode 100644
index 0000000000..044d6dce9c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-modules</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <name>Apache Tuscany SCA API</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>package</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <attach>true</attach>
+ <quiet>true</quiet>
+ <bottom>Apache Tuscany is an effort undergoing incubation at the Apache Software Foundation(ASF) and sponsored by the Apache WS PMC.</bottom>
+ <header>Apache Tuscany OSOA SCA API</header>
+ <footer>Apache Tuscany OSOA SCA API</footer>
+ <sourcepath>${basedir}/src/main/java${path.separator}${basedir}/target/generated/src/main/java</sourcepath>
+ <subpackages>org.osoa.sca</subpackages>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java
new file mode 100644
index 0000000000..c32d229a76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.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.osoa.sca;
+
+/**
+ * Common superclass for references that can be passed between components.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
+ */
+public interface CallableReference<B> {
+ /**
+ * Returns a type-safe reference to the target of this reference.
+ * The instance returned is guaranteed to implement the business interface for this reference
+ * but may not be a proxy as defined by java.lang.reflect.Proxy.
+ *
+ * @return a proxy to the target that implements the business interface associated with this reference
+ */
+ B getService();
+
+ /**
+ * Returns the Java class for the business interface associated with this reference.
+ *
+ * @return the Class for the business interface associated with this reference
+ */
+ Class<B> getBusinessInterface();
+
+ /**
+ * Returns true if this reference is conversational.
+ *
+ * @return true if this reference is conversational
+ */
+ boolean isConversational();
+
+ /**
+ * Returns the conversation associated with this reference.
+ * Returns null if no conversation is currently active.
+ *
+ * @return the conversation associated with this reference; may be null
+ */
+ Conversation getConversation();
+
+ /**
+ * Returns the callback ID.
+ *
+ * @return the callback ID
+ */
+ Object getCallbackID();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java
new file mode 100644
index 0000000000..616d4c6338
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.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.osoa.sca;
+
+/**
+ * Interface providing programmatic access to a component's SCA context as an alternative to injection.
+ * It provides access to reference and property values for the component and provides a mechanism for
+ * obtaining a reference to a service that can be passed to other components.
+ * <p/>
+ * SCA components obtain an instance of this interface through injection. Non-SCA client code may also
+ * obtain an instance through runtime-specific mechanisms.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ComponentContext {
+ /**
+ * Returns the absolute URI of the component within the SCA Domain.
+ *
+ * @return the absolute URI of the component
+ */
+ String getURI();
+
+ /**
+ * Cast a type-safe reference to a CallableReference.
+ * Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service
+ * then a ServiceReference will be returned, if the target refers to a callback then a CallableReference
+ * will be returned.
+ *
+ * @param target a reference proxy provided by the SCA runtime
+ * @param <B> the Java type of the business interface for the reference
+ * @param <R> the type of reference to be returned
+ * @return a CallableReference equivalent for the proxy
+ * @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime
+ */
+ <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a reference defined by this component.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
+ * @return an object that implements the business interface
+ */
+ <B> B getService(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Returns a ServiceReference for a reference defined by this component.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference for the designated reference
+ */
+ <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Returns the value of an SCA property defined by this component.
+ *
+ * @param type the Java type to be returned for the property
+ * @param propertyName the name of the property whose value should be returned
+ * @param <B> the Java type of the property
+ * @return the property value
+ */
+ <B> B getProperty(Class<B> type, String propertyName);
+
+ /**
+ * Returns a ServiceReference that can be used to invoke this component over the default service.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference that will invoke this component
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface);
+
+ /**
+ * Returns a ServiceReference that can be used to invoke this component over the designated service.
+ *
+ * @param businessInterface the interface that will be used to invoke the service
+ * @param serviceName the name of the service to invoke
+ * @param <B> the Java type of the business interface for the reference
+ * @return a ServiceReference that will invoke this component
+ */
+ <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns the context for the current SCA service request, or null if there is no current request
+ * or if the context is unavailable.
+ *
+ * @return the SCA request context; may be null
+ */
+ RequestContext getRequestContext();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Constants.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Constants.java
new file mode 100644
index 0000000000..b1b2af8048
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Constants.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.osoa.sca;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface Constants {
+ /**
+ * Namespace for intents.
+ */
+ String SCA_NS = "http://www.osoa.org/xmlns/sca/1.0";
+
+ /**
+ * Prefix form of the namespace that can be prepended to intent declarations.
+ */
+ String SCA_PREFIX = '{' + SCA_NS + '}';
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java
new file mode 100644
index 0000000000..64423a4aa2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/Conversation.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.osoa.sca;
+
+/**
+ * Interface representing a Conversation providing access to the conversation id and and a mechanism
+ * to terminate the conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Conversation {
+ /**
+ * Returns the identifier for this conversation.
+ * If a user-defined identity had been supplied for this reference then its value will be returned;
+ * otherwise the identity generated by the system when the conversation was initiated will be returned.
+ *
+ * @return the identifier for this conversation
+ */
+ Object getConversationID();
+
+ /**
+ * End this conversation.
+ */
+ void end();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java
new file mode 100644
index 0000000000..63e3907cff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate the conversation being used for a stateful interaction has been ended.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConversationEndedException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public ConversationEndedException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
new file mode 100644
index 0000000000..7c067a3a43
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.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.osoa.sca;
+
+/**
+ * Exception thrown to indicate that no callback has been registered
+ * when interacting with a service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class NoRegisteredCallbackException extends ServiceRuntimeException {
+ private static final long serialVersionUID = 3734864942222558406L;
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException() {
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param message passed to ServiceRuntimeException
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from ServiceRuntimeException.
+ *
+ * @param cause passed to ServiceRuntimeException
+ * @see ServiceRuntimeException
+ */
+ public NoRegisteredCallbackException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java
new file mode 100644
index 0000000000..900d5eecc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.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.osoa.sca;
+
+import javax.security.auth.Subject;
+
+/**
+ * Interface that provides information on the current request.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface RequestContext {
+ /**
+ * Returns the JAAS Subject of the current request.
+ *
+ * @return the Subject of the current request
+ */
+ Subject getSecuritySubject();
+
+ /**
+ * Returns the name of the service that was invoked.
+ *
+ * @return the name of the service that was invoked
+ */
+ String getServiceName();
+
+ /**
+ * Returns a CallableReference for the service that was invoked by the caller.
+ *
+ * @param <B> the Java type of the business interface for the reference
+ * @return a CallableReference for the service that was invoked by the caller
+ */
+ <B> CallableReference<B> getServiceReference();
+
+ /**
+ * Returns a type-safe reference to the callback provided by the caller.
+ *
+ * @param <CB> the Java type of the business interface for the callback
+ * @return a type-safe reference to the callback provided by the caller
+ */
+ <CB> CB getCallback();
+
+ /**
+ * Returns a CallableReference to the callback provided by the caller.
+ *
+ * @param <CB> the Java type of the business interface for the callback
+ * @return a CallableReference to the callback provided by the caller
+ */
+ <CB> CallableReference<CB> getCallbackReference();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java
new file mode 100644
index 0000000000..8790aac4fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.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.osoa.sca;
+
+
+/**
+ * A ServiceReference represents a client's perspective of a reference to another service.
+ *
+ * @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
+ */
+public interface ServiceReference<B> extends CallableReference<B> {
+ /**
+ * Returns the id supplied by the user that will be associated with conversations initiated through this reference.
+ *
+ * @return the id to associated with any conversation initiated through this reference
+ */
+ Object getConversationID();
+
+ /**
+ * Set the id to associate with any conversation started through this reference.
+ * If the value supplied is null then the id will be generated by the implementation.
+ *
+ * @param conversationId the user-defined id to associated with a conversation
+ * @throws IllegalStateException if a conversation is currently associated with this reference
+ */
+ void setConversationID(Object conversationId) throws IllegalStateException;
+
+ /**
+ * Sets the callback ID.
+ *
+ * @param callbackID the callback ID
+ */
+ void setCallbackID(Object callbackID);
+
+ /**
+ * Returns the callback object.
+ *
+ * @return the callback object
+ */
+ Object getCallback();
+
+ /**
+ * Sets the callback object.
+ *
+ * @param callback the callback object
+ */
+ void setCallback(Object callback);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java
new file mode 100644
index 0000000000..1c6b436afa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.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.osoa.sca;
+
+
+/**
+ * Base for Exceptions that may be raised by an SCA runtime and which typical
+ * application code is not expected to be able to handle.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = -3876058842262557092L;
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException() {
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param message passed to RuntimeException
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Override constructor from RuntimeException.
+ *
+ * @param cause passed to RuntimeException
+ * @see RuntimeException
+ */
+ public ServiceRuntimeException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java
new file mode 100644
index 0000000000..d3543799ed
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.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.osoa.sca;
+
+/**
+ * Exception used to indicate that a runtime exception occurred during the invocation of and external service.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ServiceUnavailableException extends ServiceRuntimeException {
+
+ private static final long serialVersionUID = -5869397223249401047L;
+
+ /**
+ * Constructs a new ServiceUnavailableException.
+ */
+ public ServiceUnavailableException() {
+ super((Throwable) null);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message.
+ *
+ * @param message The detail message (which is saved to later retrieval by the getMessage() method).
+ */
+ public ServiceUnavailableException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified cause.
+ *
+ * @param cause The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructs a new ServiceUnavailableException with the specified detail message and cause.
+ *
+ * @param message The message (which is saved to later retrieval by the getMessage() method).
+ * @param cause The cause (which is saved to later retrieval by the getCause() method).
+ */
+ public ServiceUnavailableException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
new file mode 100644
index 0000000000..bab9713026
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a method that indicates that its parameters may safely
+ * be passed by reference. The annotation may also be placed on an interface
+ * or class to indicate that all declared methods support this optimization.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD})
+@Retention(RUNTIME)
+public @interface AllowsPassByReference {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java
new file mode 100644
index 0000000000..1d1ecdbc13
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation denoting the intent that service operations require authentication.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require authentication.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require authentication; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require authentication.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require authentication.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require authentication.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require authentication.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Authentication.AUTHENTICATION)
+public @interface Authentication {
+ String AUTHENTICATION = SCA_PREFIX + "authentication";
+ String AUTHENTICATION_MESSAGE = AUTHENTICATION + "message";
+ String AUTHENTICATION_TRANSPORT = AUTHENTICATION + "transport";
+
+ /**
+ * List of authentication qualifiers (such as "message" or "transport").
+ *
+ * @return authentication qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java
new file mode 100644
index 0000000000..a9fc36f769
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * When placed on a service interface, this annotation specifies the interface
+ * to be used for callbacks.
+ * <p/>
+ * When placed on a method or field, this annotation denotes the injection
+ * site to be used for a callback reference.
+ * <p/>
+ * There is a error in the 1.00 draft spec in the declaration of this interface.
+ * The form defined here is a proposed correction for that error.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Callback {
+ /**
+ * The Class of the associated callback interface.
+ *
+ * @return the associated callback interface
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java
new file mode 100644
index 0000000000..477053670a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a field or method that is used to inject the component's name.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ComponentName {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java
new file mode 100644
index 0000000000..f54e421c81
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation denoting the intent that service operations require confidentiality.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require confidentiality.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require confidentiality; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require confidentiality.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require confidentiality.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require confidentiality.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require confidentiality.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Confidentiality.CONFIDENTIALITY)
+public @interface Confidentiality {
+ String CONFIDENTIALITY = SCA_PREFIX + "confidentiality";
+ String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message";
+ String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport";
+
+ /**
+ * List of confidentiality qualifiers (such as "message" or "transport").
+ *
+ * @return confidentiality qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java
new file mode 100644
index 0000000000..86d2d6560d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to indicate the constructor the runtime is to use when instantiating a component implementation instance
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(CONSTRUCTOR)
+@Retention(RUNTIME)
+public @interface Constructor {
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java
new file mode 100644
index 0000000000..37f767c1f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a field or setter method that is used to inject an SCA context.
+ * The type of context injected is determined by the type of the field or the parameter
+ * to the setter method and is typically a ComponentContext or RequestContext.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface Context {
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
new file mode 100644
index 0000000000..51d5ae76ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.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.osoa.sca.annotations;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the characteristics of a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(ElementType.TYPE)
+@Retention(RUNTIME)
+public @interface ConversationAttributes {
+ /**
+ * The maximum time that can pass between operations in a single conversation. If this time is exceeded the
+ * container may end the conversation.
+ *
+ * @return the maximum time that can pass between operations in a single conversation
+ */
+ public String maxIdleTime() default "";
+
+ /**
+ * The maximum time that a conversation may remain active. If this time is exceeded the container may end the
+ * conversation.
+ *
+ * @return the maximum time that a conversation may remain active
+ */
+ public String maxAge() default "";
+
+ /**
+ * If true, indicates that only the user that initiated the conversation has the authority to continue it.
+ *
+ * @return true if only the user that initiated the conversation has the authority to continue it
+ */
+ public boolean singlePrincipal() default false;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java
new file mode 100644
index 0000000000..13ca9a2931
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a field or method that is used to inject the conversation ID.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD})
+@Retention(RUNTIME)
+public @interface ConversationID {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java
new file mode 100644
index 0000000000..f16bf44808
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used on a Java interface to denote a conversational service contract.
+ * <p/>
+ * The draft spec erroneously defines the targets for this as {TYPE, METHOD, FIELD}
+ * but this annotation is only applicable to interfaces.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Conversational {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java
new file mode 100644
index 0000000000..7d3da46ea9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a method that will be called by the container when the
+ * scope defined for the local service ends.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Destroy {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java
new file mode 100644
index 0000000000..b9483bc9a8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate an instance should be eagerly initialized.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface EagerInit {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java
new file mode 100644
index 0000000000..9e6942651b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a method ends a conversation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface EndsConversation {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java
new file mode 100644
index 0000000000..32654fea17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a method that will be called by the container when the scope defined for the local
+ * service begins.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Init {
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java
new file mode 100644
index 0000000000..1a9288934c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static org.osoa.sca.Constants.SCA_PREFIX;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation denoting the intent that service operations require integrity.
+ * <p/>
+ * Applied to the injection site (field, method or constructor parameter) for a reference,
+ * it indicates that all invocations through that reference require integrity.
+ * <p/>
+ * Applied to a interface method on a service contract, it indicates that all invocations
+ * of that service operation require integrity; applied to the type of a service contract,
+ * it indicates that all service operations on that interface require integrity.
+ * <p/>
+ * Applied to a method on an implementation class, it indicates that all invocations that
+ * are dispatched to that implementation method (through any service) require integrity.
+ * Applied to a interface implemented by an implementation class, it indicates that all
+ * invocations that are dispatched to the implementation method for that interface operation
+ * require integrity.
+ * <p/>
+ * Applied to an implementation class, it indicates that all invocations of that implementation
+ * and that all invocations made by that implementation require integrity.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+@Intent(Integrity.INTEGRITY)
+public @interface Integrity {
+ String INTEGRITY = SCA_PREFIX + "integrity";
+ String INTEGRITY_MESSAGE = INTEGRITY + "message";
+ String INTEGRITY_TRANSPORT = INTEGRITY + "transport";
+
+ /**
+ * List of integrity qualifiers (such as "message" or "transport").
+ *
+ * @return integrity qualifiers
+ */
+ @Qualifier
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java
new file mode 100644
index 0000000000..0769a94fbb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.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 org.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that can be applied to annotations that describe SCA intents.
+ * Adding this annotation allows SCA runtimes to automatically detect user-defined intents.
+ * <p/>
+ * Applications must specify a value, a pairing of targetNamespace and localPort, or both.
+ * If both value and pairing are supplied they must define the name qualified name.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({ANNOTATION_TYPE})
+@Retention(RUNTIME)
+public @interface Intent {
+ /**
+ * The qualified name of the intent, in the form defined by {@link javax.xml.namespace.QName#toString}.
+ *
+ * @return the qualified name of the intent
+ */
+ String value() default "";
+
+ /**
+ * The XML namespace for the intent.
+ *
+ * @return the XML namespace for the intent
+ */
+ String targetNamespace() default "";
+
+ /**
+ * The name of the intent within its namespace.
+ *
+ * @return name of the intent within its namespace
+ */
+ String localPart() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java
new file mode 100644
index 0000000000..fbc7398da4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation on a method that indicates that the method is non-blocking and communication
+ * with the service provider may use buffer the requests and send them at some later time.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface OneWay {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java
new file mode 100644
index 0000000000..57247cd8a3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that allows application of SCA Policy Sets.
+ * <p/>
+ * Each policy set is specified using its XML QName in the form defined by {@link javax.xml.namespace.QName#toString()}.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE, FIELD, METHOD, PARAMETER})
+@Retention(RUNTIME)
+public @interface PolicySets {
+ /**
+ * Returns the policy sets to be applied.
+ *
+ * @return the policy sets to be applied
+ */
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java
new file mode 100644
index 0000000000..864a69b19a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is
+ * used to inject a configuration property value.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Property {
+ /**
+ * The name of the property. If not specified then the name will be derived
+ * from the annotated field or method.
+ *
+ * @return the name of the property
+ */
+ String name() default "";
+
+ /**
+ * Indicates whether a value for the property must be provided.
+ *
+ * @return true if a value must be provided
+ */
+ boolean required() default false;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java
new file mode 100644
index 0000000000..a0abe16068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that can be applied to an attribute of an @Intent annotation to indicate the
+ * attribute provides qualifiers for the intent.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+public @interface Qualifier {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java
new file mode 100644
index 0000000000..e07f70c2fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a constructor parameter, field or method that is used to inject a reference.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({METHOD, FIELD, PARAMETER})
+@Retention(RUNTIME)
+public @interface Reference {
+ /**
+ * The name of the reference. If not specified then the name will be derived from the annotated field or method.
+ *
+ * @return the name of the reference
+ */
+ public String name() default "";
+
+ /**
+ * Indicates if a reference must be specified.
+ *
+ * @return true if a reference must be specified
+ */
+ public boolean required() default true;
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java
new file mode 100644
index 0000000000..1021f6e37f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a Java interface as remotable.
+ * Remotable interfaces use pass-by-value semantics, can be published as entry points
+ * and used for external services.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Remotable {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java
new file mode 100644
index 0000000000..aa439cabab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation that allows the attachment of any intent to a Java Class or interface or to members of that
+ * class such as methods, fields or constructor parameters.
+ * <p/>
+ * Intents are specified as XML QNames in the representation defined by
+ * {@link javax.xml.namespace.QName#toString()}. Intents may be qualified with one or more
+ * suffixes separated by a "." such as:
+ * <ul>
+ * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality</li>
+ * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality.message</li>
+ * </ul>
+ * This annotation supports general purpose intents specified as strings. Users may also define
+ * specific intents using the {@link @org.osoa.sca.annotations.Intent} annotation.
+ *
+ * @version $Rev$ $Date$
+ */
+@Inherited
+@Retention(RUNTIME)
+@Target({TYPE, METHOD, FIELD, PARAMETER})
+public @interface Requires {
+ /**
+ * Returns the attached intents.
+ *
+ * @return the attached intents
+ */
+ String[] value() default "";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java
new file mode 100644
index 0000000000..6fded2dec8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate a scoped service.
+ * <p/>
+ * The spec refers to but does not describe an eager() attribute; this is an error in the draft.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target(TYPE)
+@Retention(RUNTIME)
+public @interface Scope {
+ /**
+ * The name of the scope. Values currently defined by the specification are:
+ * <ul>
+ * <li>STATELESS (default)</li>
+ * <li>REQUEST</li>
+ * <li>CONVERSATION</li>
+ * <li>COMPOSITE</li>
+ * </ul>
+ *
+ * @return the name of the scope
+ */
+ String value() default "STATELESS";
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java
new file mode 100644
index 0000000000..1e475cd4c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.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.osoa.sca.annotations;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation used to indicate the service interfaces exposed by a Java class.
+ *
+ * @version $Rev$ $Date$
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface Service {
+ /**
+ * Array of interfaces that should be exposed as services.
+ *
+ * @return a list of interfaces that should be exposed as services
+ */
+ Class<?>[] interfaces() default {};
+
+ /**
+ * Shortcut allowing a single interface to be exposed.
+ *
+ * @return a single service interfaces to be exposed
+ */
+ Class<?> value() default Void.class;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/DISCLAIMER b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/DISCLAIMER
new file mode 100644
index 0000000000..d68a410903
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/LICENSE b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/LICENSE
new file mode 100644
index 0000000000..8aa906c321
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/NOTICE
new file mode 100644
index 0000000000..94481d6cfa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/pom.xml b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/pom.xml
new file mode 100644
index 0000000000..ec66cd1db2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/pom.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-wsdl2java</artifactId>
+ <name>Apache Tuscany Axis2 WSDL2Java Tool</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating-beta1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>2.8.1</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>1.2</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-java2wsdl</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-codegen</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.emf</groupId>
+ <artifactId>codegen-ecore</artifactId>
+ <version>2.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>0.1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>woodstox</groupId>
+ <artifactId>wstx-asl</artifactId>
+ <version>3.2.0</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/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating-beta1</version>
+ <executions>
+ <execution>
+ <id>generate-sdo</id>
+ <phase>generate-test-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/test/resources/CreditScoreDocLit.wsdl</schemaFile>
+ <javaPackage>org.example.creditscore.doclit</javaPackage>
+ <noNotification>true</noNotification>
+ <noContainer>true</noContainer>
+ <noUnsettable>true</noUnsettable>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <!-- <id>eclipse.emf</id>
+ <url>http://download.eclipse.org/tools/emf/maven2</url> -->
+ <!-- <id>osuosl.org</id>
+ <url>http://ftp.osuosl.org/pub/eclipse/tools/emf/maven2</url> -->
+ <!-- temporarily using indiana state univ as eclipse site diesnt have 2.2.2 at the moment -->
+ <id>indiana</id>
+ <url>http://ftp.ussg.iu.edu/eclipse/modeling/emf/emf/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.java
new file mode 100644
index 0000000000..f24cd7e0b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceEmitter.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.tools.wsdl2java.generate;
+
+import static org.apache.tuscany.tools.wsdl2java.util.XMLNameUtil.getJavaNameFromXMLName;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.description.AxisMessage;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.WSDL2Constants;
+import org.apache.axis2.util.FileWriter;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.emitter.JavaEmitter;
+import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Overrides the Axis2 JavaEmitter to generate unwrapped methods.
+ */
+public class JavaInterfaceEmitter extends JavaEmitter {
+
+ private CodeGenConfiguration codegenConfiguration;
+ private TypeMapper typeMapper;
+
+ public void setCodeGenConfiguration(CodeGenConfiguration configuration) {
+ super.setCodeGenConfiguration(configuration);
+ codegenConfiguration=configuration;
+ }
+
+ public void setMapper(TypeMapper typeMapper) {
+ super.setMapper(typeMapper);
+ this.typeMapper = typeMapper;
+ }
+
+ private List getParameterElementList(Document doc, AxisMessage message, boolean wrapped) {
+ List parameterElementList = new ArrayList();
+
+ if (message != null && message.getElementQName()!=null) {
+
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(message.getElementQName());
+ List typeMappings;
+ if (wrapped) {
+ typeMappings = (List)typeMappingEntry.getPropertyClassNames();
+ } else {
+ typeMappings = new ArrayList();
+ typeMappings.add(typeMappingEntry.getClassName());
+ }
+
+ for (int i=0; i<typeMappings.size(); i++) {
+ Element param = doc.createElement("param");
+ parameterElementList.add(param);
+
+ String typeMapping = (String)typeMappings.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(message.getElementQName()), param);
+ addAttribute(doc, "type", (typeMapping == null)
+ ? ""
+ : typeMapping, param);
+
+ // add an extra attribute to say whether the type mapping is the default
+ // if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMapping)) {
+ if (typeMapper.getDefaultMappingName().equals(typeMapping)) {
+
+ addAttribute(doc, "default", "yes", param);
+ }
+
+ addAttribute(doc, "value", null, param);
+
+ // add this as a body parameter
+ addAttribute(doc, "location", "body", param);
+
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ public List getParameterElementList(Document doc, List parameters, String location) {
+ List parameterElementList = new ArrayList();
+
+ if ((parameters != null) && !parameters.isEmpty()) {
+ int count = parameters.size();
+
+ for (int i = 0; i < count; i++) {
+ Element param = doc.createElement("param");
+ QName name = (QName) parameters.get(i);
+
+ addAttribute(doc, "name", this.typeMapper.getParameterName(name), param);
+
+ String typeMapping = this.typeMapper.getTypeMappingName(name);
+ String typeMappingStr = (typeMapping == null)
+ ? ""
+ : typeMapping;
+
+ addAttribute(doc, "type", typeMappingStr, param);
+ addAttribute(doc, "location", location, param);
+ parameterElementList.add(param);
+ }
+ }
+
+ return parameterElementList;
+ }
+
+ protected boolean isWrapped(AxisOperation operation) {
+ boolean wrapped = false;
+
+ if (isInputPresentForMEP(operation.getMessageExchangePattern())) {
+ QName qname = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE).getElementQName();
+ if (qname != null && qname.getLocalPart().equals(operation.getName().getLocalPart())) {
+
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ (SDODataBindingTypeMappingEntry)this.typeMapper.getTypeMappingObject(qname);
+ if (typeMappingEntry.isAnonymous()) {
+ wrapped = true;
+ }
+ }
+ }
+
+ return wrapped;
+ }
+
+ private boolean isInputPresentForMEP(String MEP) {
+
+
+ // TODO: verify if thi is still correct with Axis2 1.2
+ return WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDL2Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+ WSDLConstants.WSDL20_2006Constants.MEP_URI_IN_OUT.equals(MEP) ||
+
+ WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.endsWith(MEP);
+
+
+
+
+ }
+
+ protected Element getInputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "input", operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getOutputElement(Document doc, AxisOperation operation, List headerParameterQNameList) {
+ return getElement(doc, "output", operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE), isWrapped(operation), headerParameterQNameList);
+ }
+
+ protected Element getElement(Document doc, String elementName, AxisMessage message, boolean wrapped, List headerParameterQNameList) {
+ Element element = doc.createElement(elementName);
+
+ List parameterElementList = getParameterElementList(doc, message, wrapped);
+ for (int i = 0; i < parameterElementList.size(); i++) {
+ element.appendChild((Element) parameterElementList.get(i));
+ }
+
+ List outputElementList = getParameterElementList(doc, headerParameterQNameList, "header");
+
+ for (int i = 0; i < outputElementList.size(); i++) {
+ element.appendChild((Element) outputElementList.get(i));
+ }
+
+ return element;
+ }
+
+ protected void writeInterface(boolean writeDatabinders) throws Exception {
+ Document interfaceModel = createDOMDocumentForInterface(writeDatabinders);
+ if (!codegenConfiguration.getOutputLocation().exists()) {
+ codegenConfiguration.getOutputLocation().mkdirs();
+ }
+ InterfaceWriter interfaceWriter = new RemotableInterfaceWritter(this.codegenConfiguration
+ .getOutputLocation(), this.codegenConfiguration.getOutputLanguage());
+
+ String packageName = interfaceModel.getDocumentElement().getAttribute("package");
+ String className = interfaceModel.getDocumentElement().getAttribute("name");
+
+ System.out.println(">> Generating Java class " + packageName + "." + className);
+ File outputFile = FileWriter.createClassFile(this.codegenConfiguration.getOutputLocation(),
+ packageName, className, ".java");
+ if (outputFile.exists()) {
+ outputFile.delete();
+ }
+
+ writeClass(interfaceModel, interfaceWriter);
+ }
+
+ protected String makeJavaClassName(String word) {
+ //return XMLNameUtil.getJavaNameFromXMLName(word, true);
+ return getJavaNameFromXMLName(word, true);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java
new file mode 100644
index 0000000000..5dc62fefdd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/JavaInterfaceGenerator.java
@@ -0,0 +1,235 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.wsdl2java.generate;
+
+import static org.apache.tuscany.tools.wsdl2java.util.XMLNameUtil.getPackageNameFromNamespace;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.util.XMLUtils;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension;
+import org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension;
+import org.apache.axis2.wsdl.codegen.extension.PackageFinder;
+import org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension;
+import org.apache.axis2.wsdl.databinding.JavaTypeMapper;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public class JavaInterfaceGenerator {
+
+ private List codegenExtensions = new ArrayList();
+ private List<CodeGenConfiguration> codegenConfigurations= new LinkedList<CodeGenConfiguration>();
+
+
+
+
+ public JavaInterfaceGenerator(String uri, String ports[], String outputLocation, String packageName,
+ Map<QName, SDODataBindingTypeMappingEntry> typeMapping) throws CodeGenerationException {
+
+ Definition definition;
+ try {
+ definition = readWSDL(uri);
+ } catch (WSDLException e) {
+ throw new CodeGenerationException(e);
+ }
+
+ HashSet interestedPorts= ports == null ? null : new HashSet(Arrays.asList(ports));
+
+ // Service service=(Service)definition.getServices().values().().next();
+
+ HashSet<QName> donePortTypes= new HashSet<QName>();
+
+ for (Iterator sIter = definition.getServices().values().iterator(); sIter.hasNext(); ) {
+ Service service = (Service) sIter.next();
+
+ QName serviceQname = service.getQName();
+ for (Iterator pIter= service.getPorts().values().iterator(); pIter.hasNext(); ) {
+ Port port= (Port) pIter.next();
+ if(interestedPorts != null && ! interestedPorts.contains(port.getName())) continue;//not iterested.
+ PortType portType= getPortType(port);
+ if(null == portType) continue; // not connected.
+ QName pQName= portType.getQName();
+ if(donePortTypes.contains(pQName)) continue; //allready did it.
+ donePortTypes.add(pQName);
+
+ if (packageName == null) {
+
+ packageName = getPackageNameFromNamespace(definition.getTargetNamespace());
+ }
+ JavaTypeMapper typeMapper = new JavaTypeMapper();
+ for (Map.Entry<QName, SDODataBindingTypeMappingEntry> e : typeMapping.entrySet()) {
+ typeMapper.addTypeMappingObject(e.getKey(), e.getValue());
+ }
+
+ WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(definition, serviceQname, port.getName());
+ builder.setCodegen(true);
+
+ AxisService axisService;
+ try {
+ axisService = builder.populateService();
+ } catch (AxisFault e) {
+ throw new CodeGenerationException(e);
+ }
+
+ axisService.setName(port.getBinding().getPortType().getQName().getLocalPart());
+ CodeGenConfiguration codegenConfiguration = new CodeGenConfiguration(Collections.EMPTY_MAP);
+ codegenConfigurations.add(codegenConfiguration);
+ codegenConfiguration.setAxisService(axisService);
+ codegenConfiguration.setAdvancedCodeGenEnabled(false);
+ codegenConfiguration.setAsyncOn(false);
+ codegenConfiguration.setDatabindingType("sdo");
+ codegenConfiguration.setGenerateAll(true);
+ codegenConfiguration.setGenerateDeployementDescriptor(false);
+ codegenConfiguration.setOutputLanguage("java");
+ codegenConfiguration.setOutputLocation(new File(outputLocation));
+ codegenConfiguration.setPackageName(packageName);
+ codegenConfiguration.setPackClasses(false);
+ codegenConfiguration.setPolicyMap(Collections.EMPTY_MAP);
+ codegenConfiguration.setPortName(port.getName());
+ codegenConfiguration.setServerSide(false);
+ codegenConfiguration.setServiceName(service.getQName().getLocalPart());
+ codegenConfiguration.setSyncOn(true);
+ codegenConfiguration.setTypeMapper(typeMapper);
+ codegenConfiguration.setWriteMessageReceiver(false);
+ codegenConfiguration.setWriteTestCase(false);
+ addExtension(new WSDLValidatorExtension(), codegenConfiguration);
+ addExtension(new PackageFinder(), codegenConfiguration);
+ addExtension(new SDODataBindingCodegenExtension(typeMapper), codegenConfiguration);
+ addExtension(new DefaultDatabindingExtension(), codegenConfiguration);
+ }
+ }
+ }
+
+
+ private PortType getPortType(Port port) {
+ Binding binding = port.getBinding();
+ if(null != binding){
+ return binding.getPortType();
+ }
+ return null;
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ private void addExtension(CodeGenExtension ext, CodeGenConfiguration codegenConfiguration) {
+ //ext.init(codegenConfiguration);
+ codegenExtensions.add(new Object[]{ext, codegenConfiguration});
+ }
+
+ public void generate() throws CodeGenerationException {
+ try {
+ for (int i = 0; i < codegenExtensions.size(); i++) {
+ //CodeGenExtension
+ Object[] pair = (Object[])codegenExtensions.get(i);
+
+ CodeGenExtension cge= (CodeGenExtension) pair[0];
+ CodeGenConfiguration cgf= (CodeGenConfiguration)pair[1];
+
+ cge.engage(cgf);
+
+ }
+
+ for(CodeGenConfiguration codegenConfiguration : codegenConfigurations){
+ JavaInterfaceEmitter emitter = new JavaInterfaceEmitter();
+ emitter.setCodeGenConfiguration(codegenConfiguration);
+ emitter.setMapper(codegenConfiguration.getTypeMapper());
+
+ emitter.writeInterface(false);
+ }
+
+ } catch (Exception e) {
+ throw new CodeGenerationException(e);
+ }
+ }
+
+ /**
+ * Read the WSDL file
+ * @param uri
+ * @return
+ * @throws WSDLException
+ */
+ private Definition readWSDL(String uri) throws WSDLException {
+
+ WSDLReader reader =
+ WSDLFactory.newInstance().newWSDLReader();
+ reader.setFeature("javax.wsdl.importDocuments", true);
+
+ File file = new File(uri);
+ String baseURI;
+
+ if (uri.startsWith("http://")){
+ baseURI = uri;
+ } else{
+ if(file.getParentFile() == null){
+ try {
+ baseURI = new File(".").getCanonicalFile().toURI().toString();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ } else {
+ baseURI = file.getParentFile().toURI().toString();
+ }
+ }
+
+ Document doc;
+ try {
+ doc = XMLUtils.newDocument(uri);
+ } catch (ParserConfigurationException e) {
+ throw new WSDLException(WSDLException.PARSER_ERROR,
+ "Parser Configuration Error",
+ e);
+ } catch (SAXException e) {
+ throw new WSDLException(WSDLException.PARSER_ERROR,
+ "Parser SAX Error",
+ e);
+
+ } catch (IOException e) {
+ throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e);
+ }
+
+ return reader.readWSDL(baseURI, doc);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.java
new file mode 100644
index 0000000000..cb413bca50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/RemotableInterfaceWritter.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.tools.wsdl2java.generate;
+
+import java.io.File;
+
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.codegen.writer.InterfaceWriter;
+
+/**
+ * @author lresende
+ */
+public class RemotableInterfaceWritter extends InterfaceWriter {
+ private static final String REMOTABLE_INTERFACE_TEMPLATE="/RemotableInterfaceTemplate.xsl";
+
+ public RemotableInterfaceWritter(String outputFileLocation) {
+ super(outputFileLocation);
+ }
+
+ public RemotableInterfaceWritter(File outputFileLocation, String language) {
+ super(outputFileLocation, language);
+ }
+
+ /**
+ * Loads the template.
+ */
+ @Override
+ public void loadTemplate() throws CodeGenerationException {
+ // the default behavior for the class writers is to use the property map from the languge specific types
+ // The properties are arranged in the following order
+ // <lang-name>.* .template=<write-class>,<template-name>
+
+ //overrida original behaviour to always load the template we specified
+ this.xsltStream = this.getClass().getResourceAsStream(REMOTABLE_INTERFACE_TEMPLATE);
+
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.java
new file mode 100644
index 0000000000..80e8f94dbf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingCodegenExtension.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.tools.wsdl2java.generate;
+
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.axis2.wsdl.codegen.extension.AbstractDBProcessingExtension;
+import org.apache.axis2.wsdl.databinding.TypeMapper;
+
+/**
+ * SDO data binding codegen extension.
+ */
+public class SDODataBindingCodegenExtension extends AbstractDBProcessingExtension {
+
+ private TypeMapper typeMapper;
+
+ public SDODataBindingCodegenExtension(TypeMapper typeMapper) {
+ this.typeMapper=typeMapper;
+ }
+
+ protected boolean testFallThrough(String dbFrameworkName) {
+ return !dbFrameworkName.equals("sdo");
+ }
+
+// public void engage() {
+// if (testFallThrough(configuration.getDatabindingType())) {
+// return;
+// }
+//
+// // Set the type mapper into the config
+// configuration.setTypeMapper(typeMapper);
+//
+// }
+
+ public void engage(CodeGenConfiguration configuration) throws CodeGenerationException {
+ if (testFallThrough(configuration.getDatabindingType())) {
+ return;
+ }
+
+ // Set the type mapper into the config
+ configuration.setTypeMapper(typeMapper);
+
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.java
new file mode 100644
index 0000000000..2d81ef12bf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/SDODataBindingTypeMappingEntry.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.tools.wsdl2java.generate;
+
+import java.util.List;
+
+/**
+ * This represents a type mapping entry, used by the JavaInterfaceEmitter to generate
+ * method signatures.
+ */
+public class SDODataBindingTypeMappingEntry {
+
+ private final boolean anonymous;
+ private final List<String> propertyClassNames;
+ private final String className;
+
+ public SDODataBindingTypeMappingEntry(String className, boolean anonymous, List<String> propertyClassNames) {
+ this.className = className;
+ this.anonymous = anonymous;
+ this.propertyClassNames = propertyClassNames;
+ }
+
+ public boolean isAnonymous() {
+ return anonymous;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public List<String> getPropertyClassNames() {
+ return propertyClassNames;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java
new file mode 100644
index 0000000000..8f3f7447b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGenerator.java
@@ -0,0 +1,349 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.tools.wsdl2java.generate;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sdo.helper.XSDHelperImpl;
+import org.apache.tuscany.sdo.util.DataObjectUtil;
+import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory;
+import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.codegen.util.CodeGenUtil;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.BasicExtendedMetaData;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+
+import commonj.sdo.helper.XSDHelper;
+
+public class WSDL2JavaGenerator {
+
+ /**
+ * Generate Java interfaces from WSDL Usage arguments: [ -targetDirectory
+ * <target-root-directory> ] [ -javaPackage <java-package-name> ]
+ * <wsdl-file> For example: generate somedir/somefile.wsdl Basic options:
+ * -targetDirectory Generates the Java source code in the specified
+ * directory. By default, the code is generated in the same directory as the
+ * input wsdl file. -javaPackage Overrides the Java package for the
+ * generated classes. By default the package name is derived from the
+ * targetNamespace of the WSDL definition being generated. For example, if
+ * the targetNamespace is "http://www.example.com/simple", the default
+ * package will be "com.example.simple".
+ */
+ public static void main(String args[]) {
+ if (args.length == 0) {
+ printUsage();
+ return;
+ }
+
+ String portName = null;
+ String targetDirectory = null;
+ String wsdlJavaPackage = null;
+ String xsdJavaPackage = null;
+
+ int index = 0;
+ for (; index < args.length && args[index].startsWith("-"); ++index) {
+ if (args[index].equalsIgnoreCase("-port")) {
+ portName = args[++index];
+ } else if (args[index].equalsIgnoreCase("-targetDirectory")) {
+ targetDirectory = args[++index];
+ } else if (args[index].equalsIgnoreCase("-javaPackage")) {
+ wsdlJavaPackage = args[++index];
+ }
+ // else if (...)
+ else {
+ printUsage();
+ return;
+ }
+ }
+
+ String wsdlFileName = args[index];
+ if (wsdlFileName == null || targetDirectory == null) {
+ printUsage();
+ return;
+ }
+
+ generateFromWSDL(wsdlFileName, portName!=null? new String[]{portName}:null, targetDirectory, wsdlJavaPackage, xsdJavaPackage, 0);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void generateFromWSDL(String wsdlFileName, String targetDirectory,
+ String wsdlJavaPackage,
+ String xsdJavaPackage, int genOptions){
+ generateFromWSDL( wsdlFileName, null, targetDirectory,
+ wsdlJavaPackage,
+ xsdJavaPackage, genOptions);
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ public static void generateFromWSDL(String wsdlFileName, String[] ports,
+ String targetDirectory, String wsdlJavaPackage,
+ String xsdJavaPackage, int genOptions)
+ {
+
+ // Initialize the SDO runtime
+ DataObjectUtil.initRuntime();
+ EPackage.Registry packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
+ ExtendedMetaData extendedMetaData = new BasicExtendedMetaData(packageRegistry);
+ XSDHelper xsdHelper = new XSDHelperImpl(extendedMetaData, null);
+
+ try {
+
+ // Load the WSDL file
+ File inputFile = new File(wsdlFileName).getAbsoluteFile();
+ InputStream inputStream = new FileInputStream(inputFile);
+
+ // Define SDO metadata
+ xsdHelper.define(inputStream, inputFile.toURI().toString());
+
+ if (targetDirectory == null) {
+ targetDirectory = new File(wsdlFileName).getCanonicalFile().getParent();
+ } else {
+ targetDirectory = new File(targetDirectory).getCanonicalPath();
+ }
+
+ // Populate the typeMapping table that will be given to the Axis2 WSDL2Java
+ Map<QName, SDODataBindingTypeMappingEntry> typeMapping =
+ new HashMap<QName, SDODataBindingTypeMappingEntry>();
+ if (!packageRegistry.values().isEmpty()) {
+ ResourceSet resourceSet = DataObjectUtil.createResourceSet();
+
+ // Populate list of GenPackages and a map of GenClasses keyed by EClass
+ List<GenPackage> genPackages = new ArrayList<GenPackage>();
+ Map<EClass, GenClass> genClasses = new HashMap<EClass, GenClass>();
+ for (Iterator iter = packageRegistry.values().iterator(); iter.hasNext();) {
+ EPackage currentEPackage = (EPackage)iter.next();
+ String currentBasePackage = extractBasePackageName(currentEPackage, xsdJavaPackage);
+ String currentPrefix = CodeGenUtil.capName(currentEPackage.getName());
+
+ GenPackage currentGenPackage = createGenPackage(currentEPackage, currentBasePackage,
+ currentPrefix, genOptions, resourceSet);
+ genPackages.add(currentGenPackage);
+ for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
+ genClasses.put(genClass.getEcoreClass(), genClass);
+ }
+
+ }
+
+ // Process all the SDO packages
+ // Populate the qname -> interfaceName typeMapping table
+ for (GenPackage currentGenPackage : genPackages) {
+ EPackage currentEPackage = currentGenPackage.getEcorePackage();
+
+ // Populate the type mappings for all the complex types
+ for (GenClass genClass : (List<GenClass>)currentGenPackage.getGenClasses()) {
+ QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
+ extendedMetaData.getName(genClass.getEcoreClass()));
+ String interfaceName = currentGenPackage.getInterfacePackageName() + '.'
+ + genClass.getInterfaceName();
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ new SDODataBindingTypeMappingEntry(interfaceName, false, null);
+ typeMapping.put(qname, typeMappingEntry);
+ }
+
+ // Process all the global XSD elements
+ EClass documentRoot = extendedMetaData.getDocumentRoot(currentEPackage);
+ if (documentRoot != null) {
+ for (EStructuralFeature element : (List<EStructuralFeature>)extendedMetaData
+ .getElements(documentRoot)) {
+ EClassifier elementType = element.getEType();
+
+ // Handle a complex type
+ if (elementType instanceof EClass) {
+ EClass eClass = (EClass)elementType;
+
+ GenClass genClass = genClasses.get(elementType);
+ QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
+ extendedMetaData.getName(element));
+ String interfaceName = genClass.getGenPackage().getInterfacePackageName()
+ + '.' + genClass.getInterfaceName();
+ boolean anonymous = extendedMetaData.isAnonymous(eClass);
+
+ // Build list of property class names
+ List<String> propertyClassNames=new ArrayList<String>();
+ for (EStructuralFeature feature : (List<EStructuralFeature>)eClass.getEStructuralFeatures()) {
+ EClassifier propertyType = feature.getEType();
+ if (propertyType instanceof EClass) {
+ GenClass propertyGenClass = genClasses.get(propertyType);
+ String propertyClassName = propertyGenClass.getGenPackage().getInterfacePackageName()
+ + '.' + propertyGenClass.getInterfaceName();
+ propertyClassNames.add(propertyClassName);
+ } else if (propertyType instanceof EClassifier) {
+ String propertyClassName = propertyType.getInstanceClass().getName();
+ propertyClassNames.add(propertyClassName);
+ }
+ }
+
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ new SDODataBindingTypeMappingEntry(interfaceName, anonymous, propertyClassNames);
+ typeMapping.put(qname, typeMappingEntry);
+
+ } else {
+
+ // Handle a simple type
+ QName qname = new QName(extendedMetaData.getNamespace(currentEPackage),
+ extendedMetaData.getName(element));
+ String className = elementType.getInstanceClass().getName();
+ SDODataBindingTypeMappingEntry typeMappingEntry =
+ new SDODataBindingTypeMappingEntry(className, false, null);
+ typeMapping.put(qname, typeMappingEntry);
+ }
+ }
+ }
+ }
+ }
+
+ try {
+ JavaInterfaceGenerator codeGenerator = new JavaInterfaceGenerator(wsdlFileName,
+ ports,
+ targetDirectory,
+ wsdlJavaPackage,
+ typeMapping);
+ codeGenerator.generate();
+ } catch (Exception e) {
+ throw new IllegalArgumentException(e);
+ }
+
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static GenPackage createGenPackage(EPackage ePackage, String basePackage, String prefix,
+ int genOptions, ResourceSet resourceSet) {
+ GenModel genModel = ecore2GenModel(ePackage, basePackage, prefix, genOptions);
+
+ URI ecoreURI = URI.createURI("file:///" + ePackage.getName() + ".ecore");
+ URI genModelURI = ecoreURI.trimFileExtension().appendFileExtension("genmodel");
+
+ Resource ecoreResource = resourceSet.createResource(ecoreURI);
+ ecoreResource.getContents().add(ePackage);
+
+ Resource genModelResource = resourceSet.createResource(genModelURI);
+ genModelResource.getContents().add(genModel);
+
+ return (GenPackage)genModel.getGenPackages().get(0);
+ }
+
+ public static GenModel ecore2GenModel(EPackage ePackage, String basePackage,
+ String prefix, int genOptions) {
+ GenModel genModel = GenModelFactory.eINSTANCE.createGenModel();
+ genModel.initialize(Collections.singleton(ePackage));
+
+ genModel.setRootExtendsInterface("");
+ genModel.setRootImplementsInterface("commonj.sdo.DataObject");
+ genModel.setRootExtendsClass("org.apache.tuscany.sdo.impl.DataObjectImpl");
+ genModel.setFeatureMapWrapperInterface("commonj.sdo.Sequence");
+ genModel.setFeatureMapWrapperInternalInterface("org.apache.tuscany.sdo.util.BasicSequence");
+ genModel.setFeatureMapWrapperClass("org.apache.tuscany.sdo.util.BasicSequence");
+ genModel.setSuppressEMFTypes(true);
+ genModel.setSuppressEMFMetaData(true);
+ genModel.setSuppressEMFModelTags(true);
+ genModel.setCanGenerate(true);
+ // FIXME workaround java.lang.NoClassDefFoundError:
+ // org/eclipse/jdt/core/jdom/IDOMNode with 02162006 build
+ genModel.setFacadeHelperClass("Hack");
+ genModel.setForceOverwrite(true);
+
+ GenPackage genPackage = (GenPackage)genModel.getGenPackages().get(0);
+
+ if (basePackage != null) {
+ genPackage.setBasePackage(basePackage);
+ }
+ if (prefix != null) {
+ genPackage.setPrefix(prefix);
+ }
+
+ return genModel;
+ }
+
+ public static String extractBasePackageName(EPackage ePackage, String javaPackage) {
+ String qualifiedName = javaPackage != null ? javaPackage : ePackage.getName();
+ String name = /* CodeGenUtil. */shortName(qualifiedName);
+ String baseName = qualifiedName.substring(0, qualifiedName.length() - name.length());
+ if (javaPackage != null || !name.equals(qualifiedName)) {
+ ePackage.setName(name);
+ }
+ return baseName != null ? /* CodeGenUtil. */safeQualifiedName(baseName) : null;
+ }
+
+ public static String shortName(String qualifiedName) {
+ int index = qualifiedName.lastIndexOf(".");
+ return index != -1 ? qualifiedName.substring(index + 1) : qualifiedName;
+ }
+
+ public static String safeQualifiedName(String qualifiedName) {
+ StringBuffer safeQualifiedName = new StringBuffer();
+ for (StringTokenizer stringTokenizer = new StringTokenizer(qualifiedName, ".");
+ stringTokenizer.hasMoreTokens();) {
+ String name = stringTokenizer.nextToken();
+ safeQualifiedName.append(CodeGenUtil.safeName(name));
+ if (stringTokenizer.hasMoreTokens()) {
+ safeQualifiedName.append('.');
+ }
+ }
+ return safeQualifiedName.toString();
+ }
+
+ protected static void printDiagnostic(Diagnostic diagnostic, String indent) {
+ System.out.print(indent);
+ System.out.println(diagnostic.getMessage());
+ for (Iterator i = diagnostic.getChildren().iterator(); i.hasNext();) {
+ printDiagnostic((Diagnostic)i.next(), indent + " ");
+ }
+ }
+
+ protected static void printUsage() {
+ System.out.println("Usage arguments:");
+ System.out.println(" [ -targetDirectory <target-root-directory> ]");
+ System.out.println(" [ -javaPackage <java-package-name> ]");
+ System.out.println(" <wsdl-file>");
+ System.out.println("");
+ System.out.println("For example:");
+ System.out.println("");
+ System.out.println(" generate somedir/somefile.wsdl");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.java
new file mode 100644
index 0000000000..d0b325982c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/java/org/apache/tuscany/tools/wsdl2java/util/XMLNameUtil.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.tools.wsdl2java.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class XMLNameUtil {
+
+ /**
+ * Returns a valid Java name from an XML Name.
+ *
+ * @param name
+ * @param isUpperCase
+ * @return a valid Java name from an XML Name
+ */
+ public static String getJavaNameFromXMLName(String name, boolean isUpperCase) {
+ List<String> parsedName = parseName(name, '_');
+ StringBuilder result = new StringBuilder(64 * parsedName.size());
+ for (String nameComponent: parsedName) {
+ if (nameComponent.length() > 0) {
+ if (result.length() > 0 || isUpperCase) {
+ result.append(Character.toUpperCase(nameComponent.charAt(0)));
+ result.append(nameComponent.substring(1));
+ } else {
+ result.append(nameComponent);
+ }
+ }
+ }
+
+ if (result.length() == 0) {
+ return "_";
+ }
+ if (Character.isJavaIdentifierStart(result.charAt(0))) {
+ return isUpperCase ? result.toString() : decapitalizeName(result.toString());
+ }
+ return "_" + result;
+ }
+
+ /**
+ * Decapitalize a name.
+ * @param name
+ * @return a decapitalized name
+ */
+ public static String decapitalizeName(String name) {
+ if (name.length() == 0) {
+ return name;
+ } else {
+ String lowerName = name.toLowerCase();
+ int i;
+ for (i = 0; i < name.length(); i++) {
+ if (name.charAt(i) == lowerName.charAt(i)) {
+ break;
+ }
+ }
+ if (i > 1 && i < name.length()) {
+ --i;
+ }
+ return name.substring(0, i).toLowerCase() + name.substring(i);
+ }
+ }
+
+ /**
+ * Parse the given name.
+ *
+ * @param sourceName
+ * @param separator
+ * @return some stuff parsed from the name
+ */
+ private static List<String> parseName(String sourceName, char separator) {
+ List<String> result = new ArrayList<String>();
+ if (sourceName != null) {
+ StringBuilder currentWord = new StringBuilder(64);
+ boolean lastIsLower = false;
+ int index;
+ int length;
+ for (index = 0, length = sourceName.length(); index < length; ++index) {
+ char curChar = sourceName.charAt(index);
+ if (!Character.isJavaIdentifierPart(curChar)) {
+ curChar = separator;
+ }
+ if (Character.isUpperCase(curChar)
+ || (!lastIsLower && Character.isDigit(curChar))
+ || curChar == separator) {
+
+ if (lastIsLower && currentWord.length() > 1
+ || curChar == separator && currentWord.length() > 0) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ }
+ lastIsLower = false;
+ } else {
+ if (!lastIsLower) {
+ int currentWordLength = currentWord.length();
+ if (currentWordLength > 1) {
+ char lastChar = currentWord.charAt(--currentWordLength);
+ currentWord.setLength(currentWordLength);
+ result.add(currentWord.toString());
+ currentWord = new StringBuilder(64);
+ currentWord.append(lastChar);
+ }
+ }
+ lastIsLower = true;
+ }
+
+ if (curChar != separator) {
+ currentWord.append(curChar);
+ }
+ }
+
+ result.add(currentWord.toString());
+ }
+ return result;
+ }
+
+ /**
+ * Return an EPackage name for the given namespace.
+ *
+ * @param namespace
+ * @return an EPackage name for the given namespace
+ */
+ public static String getPackageNameFromNamespace(String namespace) {
+ return org.apache.tuscany.sdo.helper.SDOXSDEcoreBuilder.getDefaultPackageName(namespace);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/LICENSE.txt b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/LICENSE.txt
new file mode 100644
index 0000000000..0084319535
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/NOTICE b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000000..d83ebbe236
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/NOTICE
@@ -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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/README.txt b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/README.txt
new file mode 100644
index 0000000000..9b26d1690a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/META-INF/README.txt
@@ -0,0 +1,35 @@
+Apache Tuscany M1 build (May, 2006)
+===================================
+
+http://incubator.apache.org/tuscany/
+
+Tuscany is an effort undergoing incubation at the Apache Software Foundation
+(ASF), sponsored by the Web Services PMC.
+
+Incubation is required of all newly accepted projects until a further review
+indicates that the infrastructure, communications, and decision making process
+have stabilized in a manner consistent with other successful ASF projects.
+
+While incubation status is not necessarily a reflection of the completeness or
+stability of the code, it does indicate that the project has yet to be fully
+endorsed by the ASF.
+
+
+Support
+-------
+
+Any problem with this release can be reported to the Tuscany mailing list
+or in the JIRA issue tracker.
+
+Mailing list subscription:
+ tuscany-dev-subscribe@ws.apache.org
+
+Jira:
+ http://issues.apache.org/jira/browse/Tuscany
+
+
+Thank you for using Tuscany!
+
+
+The Tuscany Team.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl
new file mode 100644
index 0000000000..e3da5da20f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/main/resources/RemotableInterfaceTemplate.xsl
@@ -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.
+-->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <xsl:output method="text"/>
+
+ <!-- import the databinding template-->
+ <xsl:include href="databindsupporter"/>
+ <!-- import the other templates for databinding
+ Note - these names would be handled by a special
+ URI resolver during the xslt transformations
+ -->
+ <xsl:include href="externalTemplate"/>
+
+
+ <xsl:template match="/interface">
+ <xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
+ <xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
+
+ /**
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
+ package <xsl:value-of select="$package"/>;
+
+ import org.osoa.sca.annotations.Remotable;
+ import org.apache.tuscany.api.annotation.DataType;
+
+ /*
+ * <xsl:value-of select="@name"/> java interface
+ */
+
+ @Remotable
+ @DataType(name="commonj.sdo.DataObject")
+ public interface <xsl:value-of select="@name"></xsl:value-of> {
+ <xsl:for-each select="method">
+ <!-- Code for in-out mep -->
+ <xsl:if test="@mep='12'">
+ <xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
+
+ <!-- start of the sync block -->
+ <xsl:if test="$isSync='1'">
+ /**
+ * Auto generated method signatures
+ <xsl:for-each select="input/param[@type!='']">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:for-each>
+ */
+ public <xsl:choose><xsl:when test="$outputtype=''">void</xsl:when><xsl:otherwise><xsl:value-of select="$outputtype"/></xsl:otherwise></xsl:choose>
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@type!='']">
+ <xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+ <!-- end of the sync block -->
+ </xsl:if>
+
+ <!-- start of the async block -->
+ <xsl:if test="$isAsync='1'">
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param"><xsl:if test="@type!=''">* @param <xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ */
+
+ public void start<xsl:value-of select="@name"/>(
+ <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@type!=''])"></xsl:value-of></xsl:variable>
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"></xsl:value-of></xsl:if></xsl:for-each>
+ <xsl:if test="$paramCount>0">,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
+ </xsl:if>
+<!-- end of async block-->
+
+ </xsl:if>
+ <!-- Code for in-only mep -->
+ <xsl:if test="@mep='10'">
+
+ <!-- For in-only meps there would not be any asynchronous methods since there is no output -->
+ /**
+ * Auto generated method signature
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''">*@param <xsl:value-of select="@name"></xsl:value-of><xsl:text>
+ </xsl:text></xsl:if></xsl:for-each>
+ */
+ public void
+ <xsl:text> </xsl:text><xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param">
+ <xsl:if test="@type!=''"><xsl:if test="position()>1">,</xsl:if><xsl:value-of select="@type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>
+ </xsl:if>
+ </xsl:for-each>) throws java.rmi.RemoteException;
+
+ </xsl:if>
+ </xsl:for-each>
+
+ <!-- Apply other templates -->
+ //<xsl:apply-templates/>
+ }
+
+
+ </xsl:template>
+ </xsl:stylesheet> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.java
new file mode 100644
index 0000000000..c3467cbabc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/apache/tuscany/tools/wsdl2java/generate/WSDL2JavaGeneratorTestCase.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.tools.wsdl2java.generate;
+
+import junit.framework.TestCase;
+
+/**
+ * Test case for WSDL2Java
+ */
+public class WSDL2JavaGeneratorTestCase extends TestCase {
+
+ public void testAccountService() {
+
+ String basedir = System.getProperty("basedir");
+ if (basedir == null)
+ basedir =".";
+
+
+ String[] args=new String[] { "-targetDirectory", basedir + "/target/wsdl2java-source",
+ "-javaPackage", "org.apache.tuscany.tools.wsdl2java.generate.account",
+ basedir + "/src/test/resources/AccountService.wsdl"};
+
+ WSDL2JavaGenerator.main(args);
+
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.java
new file mode 100644
index 0000000000..e9e8aa882a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/java/org/soapinterop/CreditScoreDocLit.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.soapinterop;
+
+public interface CreditScoreDocLit {
+ public org.example.creditscore.doclit.CreditReport getCreditScore(
+ org.example.creditscore.doclit.Customer param0) throws java.rmi.RemoteException;
+ }
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/AccountService.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/AccountService.wsdl
new file mode 100644
index 0000000000..e7be3ce5ba
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl
new file mode 100644
index 0000000000..09d1a58589
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/CreditScoreDocLit.wsdl
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2005 The Apache Software Foundation or its licensors, as applicable.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:tns="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CreditScore"
+ targetNamespace="http://www.example.org/creditscore/doclit/">
+ <wsdl:types>
+ <xsd:schema
+ targetNamespace="http://www.example.org/creditscore/doclit/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="getCreditScoreRequest" type="tns:Customer" />
+ <xsd:complexType name="Customer">
+ <xsd:sequence>
+ <xsd:element name="ssn" type="xsd:string" />
+ <xsd:element name="firstName" type="xsd:string" />
+ <xsd:element name="lastName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:element name="getCreditScoreResponse" type="tns:CreditReport"/>
+ <xsd:complexType name="CreditReport">
+ <xsd:sequence>
+ <xsd:element name="score" type="xsd:int"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getCreditScoreResponse">
+ <wsdl:part element="tns:getCreditScoreResponse"
+ name="getCreditScoreResponse" />
+ </wsdl:message>
+ <wsdl:message name="getCreditScoreRequest">
+ <wsdl:part element="tns:getCreditScoreRequest"
+ name="getCreditScoreRequest" />
+ </wsdl:message>
+ <wsdl:portType name="CreditScoreDocLit">
+ <wsdl:operation name="getCreditScore">
+ <wsdl:input message="tns:getCreditScoreRequest" />
+ <wsdl:output message="tns:getCreditScoreResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="CreditScoreDocLitSOAP" type="tns:CreditScoreDocLit">
+ <soap:binding style="document"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getCreditScore">
+ <soap:operation
+ soapAction="http://www.example.org/creditscore/doclit/getCreditScore" />
+ <wsdl:input>
+ <soap:body parts="getCreditScoreRequest" use="literal" />
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body parts="getCreditScoreResponse" use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="CreditScore">
+ <wsdl:port binding="tns:CreditScoreDocLitSOAP"
+ name="CreditScoreDocLitSOAP">
+ <soap:address location="http://www.example.org/" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/helloworld.wsdl
new file mode 100644
index 0000000000..051f604bb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/helloworld.wsdl
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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://helloworldaxis.samples.tuscany.apache.org" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://helloworldaxis.samples.tuscany.apache.org" xmlns:intf="http://helloworldaxis.samples.tuscany.apache.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="stockquote">
+ <!--WSDL created by Apache Axis version: 1.2.1
+Built on Jun 14, 2005 (09:15:57 EDT)-->
+ <wsdl:types>
+ <schema elementFormDefault="qualified"
+ xmlns:hello="http://helloworldaxis.samples.tuscany.apache.org"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="http://helloworldaxis.samples.tuscany.apache.org" xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="ComplexGreetings">
+ <sequence>
+ <element name="greet1" type="xsd:string"/>
+ <element name="greet2" type="xsd:double"/>
+ </sequence>
+ </complexType>
+ <element name="getGreetings">
+ <complexType>
+ <sequence>
+ <element name="in0" type="xsd:string"/>
+ <element name="in1" type="xsd:double"/>
+ <element name="in2" type="hello:ComplexGreetings"/>
+ </sequence>
+ <xsd:attribute name="language" type="xsd:string"/>
+ </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="impl:getGreetings" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:message name="getGreetingsResponse">
+
+ <wsdl:part element="impl:getGreetingsResponse" name="parameters"/>
+
+ </wsdl:message>
+
+ <wsdl:portType name="HelloWorldServiceImpl">
+
+ <wsdl:operation name="getGreetings">
+
+ <wsdl:input message="impl:getGreetingsRequest" name="getGreetingsRequest"/>
+
+ <wsdl:output message="impl:getGreetingsResponse" name="getGreetingsResponse"/>
+
+ </wsdl:operation>
+
+ </wsdl:portType>
+
+ <wsdl:binding name="helloworldSoapBinding" type="impl:HelloWorldServiceImpl">
+
+ <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="HelloWorldServiceImplService">
+
+ <wsdl:port binding="impl:helloworldSoapBinding" name="helloworld">
+
+ <!-- Tuscany SCA Service -->
+<!--
+ <wsdlsoap:address location="http://localhost:8080/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+-->
+ <wsdlsoap:address location="http://localhost:9876/tuscany-samples-helloworldws-service/services/HelloWorldService"/>
+
+ <!-- Axis Web Service -->
+ <!--
+ <wsdlsoap:address location="http://localhost:8081/helloworldaxissvc-incubating-M1/services/helloworld"/>
+ -->
+
+ </wsdl:port>
+
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/interopdoc.wsdl b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/interopdoc.wsdl
new file mode 100644
index 0000000000..820c26ca34
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/sequences.xsd b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/src/test/resources/sequences.xsd
new file mode 100644
index 0000000000..a565f3fa65
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/modules/wsdl2java/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/sca-java-1.x/branches/sca-java-0.90/pom.xml b/sca-java-1.x/branches/sca-java-0.90/pom.xml
new file mode 100644
index 0000000000..4eb3881677
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/pom.xml
@@ -0,0 +1,192 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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>parent</artifactId>
+ <version>2-incubating</version>
+ </parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Implementation Project</name>
+ <url>http://incubator.apache.org/tuscany/</url>
+ <version>0.90-incubating-SNAPSHOT</version>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>modules</module>
+ <module>samples</module>
+ <module>itest</module>
+ </modules>
+ </profile>
+ </profiles>
+
+ <build>
+ <defaultGoal>install</defaultGoal>
+
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>${notice.dir}</directory>
+ <targetPath>META-INF</targetPath>
+ <filtering>true</filtering>
+ <includes>
+ <include>DISCLAIMER</include>
+ <include>LICENSE</include>
+ <include>NOTICE</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <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>
+
+ <!-- surefire plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <includes>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <reportFormat>brief</reportFormat>
+ <useFile>false</useFile>
+ <forkMode>once</forkMode>
+ <argLine>-ea -Xmx128m</argLine>
+ </configuration>
+ </plugin>
+
+ <!-- jar plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Extension-Name>${project.artifactId}</Extension-Name>
+ <Specification-Title>${name}</Specification-Title>
+ <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
+ <Specification-Version>${version}</Specification-Version>
+ <Implementation-Title>${name}</Implementation-Title>
+ <Implementation-Vendor-Id>org.apache</Implementation-Vendor-Id>
+ <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
+ <Implementation-Version>${version}</Implementation-Version>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ <version>2.1</version>
+ </plugin>
+
+ <!-- source code style check plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>2.1</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany</groupId>
+ <artifactId>buildtools</artifactId>
+ <version>2-incubating</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <configuration>
+ <configLocation>tuscany-checkstyle.xml</configLocation>
+ <suppressionsLocation>tuscany-suppressions.xml</suppressionsLocation>
+ <consoleOutput>true</consoleOutput>
+ <failsOnError>true</failsOnError>
+ <linkXRef>false</linkXRef>
+ <sourceDirectory>${basedir}/src</sourceDirectory>
+ <propertyExpansion>${checkstyle.properties}</propertyExpansion>
+ </configuration>
+ <goals>
+ <goal>checkstyle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- code semantic check plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <rulesets>
+ <ruleset>${basedir}/.ruleset</ruleset>
+ </rulesets>
+ <linkXRef>false</linkXRef>
+ <targetJdk>1.5</targetJdk>
+ </configuration>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- code coverage check plugin configuration -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <jdk>1.5</jdk>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/README b/sca-java-1.x/branches/sca-java-0.90/samples/README
new file mode 100644
index 0000000000..029afaa855
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/README
@@ -0,0 +1,245 @@
+The Apache Tuscany SCA Samples
+==============================
+The Apache Tuscany SCA samples are built as part of the main Maven build and
+run, using the provided JUnit tests cases, as tests in the Maven build.
+
+In the binary distribution of Apache Tuscany the samples can also
+be run using the provided Ant build.xml file. This shows the samples running
+from a simple main() method without the need for a JUnit test case.
+
+In these notes text that appears in angled brackets like this <example> means
+that you need to make a choice and provide you own text at that point.
+
+Sample Overview
+---------------
+The samples generally show off different features of the SCA runtime
+and the extensions that come packaged with it. This list is ordered in a rough
+order of increasing complexity.
+
+calculator - A calculator built with java components and local
+ wires
+simple-bigbank - A banking application built with java components
+ and local wires
+calculator-script - The calculator but this time built using various
+ script languages
+calculator-web - The calculator again but this time running inside a
+ web app
+helloworld-ws-reference - The client side of a hello world sample that uses a
+ web service binding
+helloworld-ws-service - The server side of a hello world sample that uses a
+ web service binding
+calculator-rmi-reference - The calculator configured to talk RMI to the
+ calculator-rmi-service samples
+calculator-rmi-service - The calculator configured to accept RMI requests
+ from calculator-rmi-reference
+helloworld-jsonrpc - An SCA application that exposes service using
+ JSONRPC
+implementation-composite - An SCA application that shows how composites are used to
+ implement components
+simple-callback - An SCA application with two components demonstrating
+ the callback interface
+supplychain - A more complicated sample showing how asynchronous
+ callbacks can be used
+databinding-echo - An SCA application that shows how databindings
+ transform data
+
+There are two samples that demonstrate how to build extensions for the
+Tuscany SCA runtime. These samples are slightly different from the samples
+above in that the provided code is concerned with building the extension
+and now with building an application that uses it. The application
+that shows how the new extension can be used is provided in an associated
+sample.
+
+implementation-crud - Shows how to build new implementation type
+ extensions
+implementation-crud-client - A sample application that exercises the new
+ implementation extensions
+binding-echo - Shows how to build new binding extensions
+binding-echo-appl - A sample application that exercises the new
+ binding extension
+
+Sample Layout
+-------------
+All sample directories are organized in the same way based on the default
+project template provided by Maven. For example, take a look at the calculator
+sample;
+
+calculator/
+ src/ - Holds all of the source files for the sample
+ main/ - Groups together the files that implement the sample
+ java/ - Java source files
+ resources/ - Non java resource files such as composte files
+ test/ - Groups together files that provide sample tests
+ java - Java test sources files. Usually JUnit test cases
+ target/ - Holds the files generated when the sample is built
+ classes/ - For example, Java class files
+
+Getting Ready To Build
+----------------------
+You will need to install the following software before you start.
+
+J2SE Development Kit (JDK) 5.0
+Apache Ant 1.7.0 - if you are going to use Ant
+Apache Maven 2.0.6 - if you are going to use Maven
+
+Java and Ant and/or Maven binary directories must be present in your PATH so
+that their executable programs are available in your environment. You may
+find it useful to use a script to set up your environment, for example;
+
+For UNIX:
+ JAVA_HOME=/<installation_directory>
+ ANT_HOME=/<installation_directory>/apache-ant-1.7.0
+ MAVEN_HOME=/<installation_directory>/maven-2.0.6
+ export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH
+
+For Windows:
+ set JAVA_HOME=C:\<installation_directory>
+ set ANT_HOME=C:\<installation_directory>\apache-ant-1.7.0
+ set MAVEN_HOME=C:\<installation_directory>\maven-2.0.6
+ set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%MAVEN_HOME%\bin;%PATH%
+
+
+Building And Running The SCA Samples Using Ant
+----------------------------------------------
+The build.xml files provided with the Apache Tuscany SCA samples are designed
+to work with the binary distribution. They rely on the tuscany-sca-manifest.jar
+to describe the class path and this jar is only provided as part of the
+binary distribution.
+
+The binary distribution of SCA also includes precompiled versions of each sample.
+If you look in the target directory of each sample you will see this jar file. To
+run a sample based on all of the precompiled artifacts all you have to do is:
+
+cd <sampledir>
+ant run
+
+Check each <sampledir>/README file as some samples require that two progams are
+run to get the desired result, for example, the two samples that show how
+to build extensions are run from their associated application samples.
+
+If you want to rebuild a sample, for example, if you have changed it, do the
+following:
+
+cd <sampledir>
+ant compile
+
+Once the sample is built you have the option of running the sample in whatever
+way best suits you. Two alternatives are provided in the ant build files.
+
+The compile target builds the class files and then builds the jar so you can use
+the same command as before:
+
+ant run
+
+This will use the generated jar to run the samples. The command line version of
+this is:
+
+on Windows
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
+
+
+You can use the compiled classes directly using
+
+ant run-classes
+
+The command line version of this is:
+
+on Windows
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes calculator.CalculatorClient
+
+on *nix
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/classes calculator.CalculatorClient
+
+The class specified on the command of course depends on which sample you want to
+run. In this case we are running the CalculatorClient from the calculator sample.
+
+
+Building And Running The SCA Samples Using Maven
+------------------------------------------------
+
+The Maven build process will work from both source and binary distributions.
+To build and test all of the Apache Tuscany SCA sources, including the samples,
+do the following.
+
+cd sca
+mvn
+
+This will take a little while to complete. Experience with Maven tells us that
+sometimes there are problems downloading the dependencies that Apache Tuscany
+SCA requires. If Maven reports that it cannot download required dependencies
+try running the Maven build again.
+
+Once you have all of the source built you can build and run each sample
+independently if required.
+
+cd <sampledir>
+mvn
+
+When using Maven the samples are run within JUnit test cases and so you will
+sometimes not see any test output. You will always see an indication of test
+success or failure.
+
+Using The Samples In An IDE Without Maven
+-----------------------------------------
+We don't provide any IDE project files with our disitributions so you will have to
+import the sample files into your IDE manually. Here's an example of how it can be
+done using Eclipse.
+
+In a new or existing workspace
+ Create a new java project to represent the sample you want to work on, e.g.
+ calculator
+ Import all of the sample code and resources into this project, e.g.
+ File, Import and then select tuscany-sca-0.90-incubating\samples\calculator from the filesystem
+ Configure the source path to include
+ src/main/java
+ src/main/resources
+ Configure the output folder to be
+ calculator/target
+ Configure the build path to include all of the jars provided in
+ lib
+ If you select calculator.CalculatorClient.java and run as "Java Application" you should see
+ 3 + 2=5.0
+ 3 - 2=1.0
+ 3 * 2=6.0
+ 3 / 2=1.5
+
+The details of how to do this for other development environments will
+vary but the process will be similar.
+
+Using The Samples In An IDE If You Have Maven
+---------------------------------------------
+If you are a Maven user you can use it to generate all
+of the IDE project files for you automatically. This works best if you
+generate IDE projects for all of the Apache Tuscany modules. You can then
+include the ones you are interested in working with in you IDE.
+
+To build IDE project files for all of the modules in Apache Tuscany SCA;
+
+cd sca
+
+If you are an Eclipse user do the following
+
+mvn -Peclipse eclipse:eclipse
+
+If you are an IDEA user do the following
+
+mvn idea:idea
+
+These commands generate project files for each module in Apache Tuscany SCA.
+The modules you are interested in can now be included in your IDE, for example,
+in Eclipse, if you create a new Java project and use the option to "create a
+new project from existing source" you can specify an SCA module directory,
+which includes the generated project files, and Eclipse will treat it like any
+other Java project.
+
+
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/README b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/README
new file mode 100644
index 0000000000..59f6aef0ff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/README
@@ -0,0 +1,104 @@
+Binding Echo Sample Application
+===============================
+This sample demonstrates how to use the new binding extension
+binding-echo
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt,
+navigate to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo\target\sample-binding-echo.jar;target\sample-binding-echo-appl.jar echo.client.EchoBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo/target/sample-binding-echo.jar:target/sample-binding-echo-appl.jar echo.client.EchoBindingClient
+
+This looks like a long command. The three things we add to the classpath are
+
+tuscany-sca-manifest.jar - all of the standard Tuscany SCA runtime and
+ extension classes
+sample-binding-echo.jar - the new echo binding extension implementation
+sample-binding-echo-appl - the application that uses the echo binding
+
+
+Sample Overview
+---------------
+This sample contains an application (client and server code) that uses
+an SCA binding that simply echoes back any messages that are sent to it.
+
+binding-echo-appl/
+ src/
+ main/
+ java/
+ echo/
+ appl/
+ Echo.java - interface definition for the sample
+ reference and service
+ EchoComponentImpl.java - sample component implementation with
+ echo binding reference
+ client/
+ EchoBindingClient.java - sample client
+ resources/
+ EchoBindingApplication.composite - the SCA assembly for this sample
+ test/
+ java/
+ echo
+ appl/
+ EchoApplTestCase.java - sample JUnit test case for the sample
+ client
+ binding-echo-appl.png - pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows.
+
+cd binding-echo-appl
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Returned message: foo
+ [java] Echo reference = foo
+ [java] Returned message: baa
+ [java] Echo service = baa
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows.
+
+cd binding-echo-appl
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echoAppl.EchoApplTestCase
+Returned message: foo
+Echo reference = foo
+Returned message: baa
+Echo service = baa
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.111 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.png b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.png
new file mode 100644
index 0000000000..a38d985363
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.svg b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.svg
new file mode 100644
index 0000000000..5b5051bef5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/binding-echo.svg
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\binding-echo"
+ sodipodi:docname="binding-echo.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\binding-echo\binding-echo.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="528.85714"
+ inkscape:cy="406.01174"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1142"
+ inkscape:window-height="722"
+ inkscape:window-x="58"
+ inkscape:window-y="135" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.038749,0,0,1.009461,-29.25616,-1.807024)">
+ <rect
+ rx="8.7034655"
+ ry="12.692303"
+ y="192.00233"
+ x="375.89822"
+ height="299.99988"
+ width="281.85843"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95312572;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(104.5213,-10.61387)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">EchoBinding</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 397.85714,346.95163 L 440,346.95163"
+ id="path1896"
+ transform="matrix(0.962696,0,0,0.990628,28.1648,1.790088)" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="450.63062"
+ y="302.8819"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.0398,96.94336)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">EchoComponent</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.4801,334.72889 L 466.81514,334.72889 L 472.87605,347.86087 L 465.80499,359.98271 L 433.4801,359.98271 L 441.05625,347.86087 L 433.4801,334.72889 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 546.73254,332.89061 L 580.06758,332.89061 L 586.12849,346.02259 L 579.05743,358.14443 L 546.73254,358.14443 L 554.30869,346.02259 L 546.73254,332.89061 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 328.15933,319.32471 L 387.4834,319.32471 L 398.26959,346.57097 L 385.68571,371.72138 L 328.15933,371.72138 L 341.64208,346.57097 L 328.15933,319.32471 z "
+ id="path1883" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 610.30199,319.1819 L 674.46121,319.1819 L 686.12651,346.05674 L 672.517,370.8643 L 610.30199,370.8643 L 624.88364,346.05674 L 610.30199,319.1819 z "
+ id="path1885" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1887"
+ transform="translate(62.97619,122.4038)"><flowRegion
+ id="flowRegion1889"><rect
+ id="rect1891"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1893"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%">Echo</flowPara><flowPara
+ id="flowPara1895"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%">Serivce</flowPara></flowRoot> <text
+ xml:space="preserve"
+ style="font-size:16px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Arial"
+ x="625.14288"
+ y="343.23737"
+ id="text1897"
+ sodipodi:linespacing="100%"><tspan
+ sodipodi:role="line"
+ id="tspan1899"
+ x="625.14288"
+ y="343.23737"
+ style="font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:100%">Echo</tspan><tspan
+ sodipodi:role="line"
+ x="625.14288"
+ y="355.23737"
+ id="tspan1901"
+ style="font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:12;text-anchor:start;text-align:start;writing-mode:lr;line-height:100%">Reference</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 585.71429,345.52305 C 624.28571,345.52305 624.28571,345.52305 624.28571,345.52305"
+ id="path1898" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/build.xml
new file mode 100644
index 0000000000..3ae7dce9f6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/build.xml
@@ -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.
+-->
+<project name="binding-echo-appl" default="compile">
+ <property name="test.class" value="echo.client.EchoBindingClient" />
+ <property name="test.jar" value="sample-binding-echo-appl.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement location="target/${test.jar}"/>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/pom.xml
new file mode 100644
index 0000000000..a4f6622d0e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo-appl</artifactId>
+ <name>Apache Tuscany Echo Binding Sample Application</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/Echo.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/Echo.java
new file mode 100644
index 0000000000..b3c5580fd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/Echo.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 echo.appl;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/EchoComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/EchoComponentImpl.java
new file mode 100644
index 0000000000..25d53129eb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/appl/EchoComponentImpl.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 echo.appl;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.java
new file mode 100644
index 0000000000..0666c282b4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/java/echo/client/EchoBindingClient.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 echo.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.appl.Echo;
+import echo.server.EchoServer;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ * @version $Rev$ $Date$
+ */
+public class EchoBindingClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("EchoBinding.composite");
+
+ // Call the echo service component which will, in turn, call a reference
+ // with an echo binding. The echo binding will echo the given string.
+ Echo service = scaDomain.getService(Echo.class, "EchoComponent");
+ String echoString = service.echo("foo");
+ System.out.println("Echo reference = " + echoString );
+
+ // Call the echo server. This will dispatch the call to a service with an
+ // echo binding. The echo binding will pass the call to the echo component.
+ echoString = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "bar");
+ System.out.println("Echo service = " + echoString );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/resources/EchoBinding.composite
new file mode 100644
index 0000000000..211ad1d3fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/main/resources/EchoBinding.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"
+ targetNamespace="http://echo"
+ xmlns:echo="http://echo"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.appl.Echo"/>
+ <binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.appl.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.appl.Echo"/>
+ <binding.echo uri="http://tempuri.org" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.java
new file mode 100644
index 0000000000..ae502e4ab6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo-appl/src/test/java/echo/appl/EchoApplTestCase.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 echo.appl;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+public class EchoApplTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testReference() throws Exception {
+ // Call the echo service component which will, in turn, call a reference
+ // with an echo binding. The echo binding will echo the given string.
+ Echo service = scaDomain.getService(Echo.class, "EchoComponent");
+ String echoString = service.echo("foo");
+ assertEquals(echoString, "foo");
+ }
+
+ public void testService() throws Exception {
+ // Call the echo server. This will dispatch the call to a service with an
+ // echo binding. The echo binding will pass the call to the echo component.
+ String echoString = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "bar");
+ assertEquals(echoString, "bar");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/README b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/README
new file mode 100644
index 0000000000..0644344266
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/README
@@ -0,0 +1,70 @@
+Binding Echo Sample
+===================
+This sample demonstrates how new bindings are constructed for Apache Tuscany
+SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the echo binding that this sample provides
+please see the binding-echo-appl sample that provides the necessary
+client and application code to bring up an application that uses this
+binding
+
+Sample Overview
+---------------
+This sample contains a implementation of an SCA binding that simply echoes back
+any messages that are sent to it.
+
+binding-echo/
+ src/
+ main/
+ java/
+ echo/ - The binding interfaces
+ impl/ - The bindings model classes
+ module/ - The activator that loads the binding into the
+ SCA runtime
+ provider/ - The bindings runtime classes
+ server/ - A dummy server that the binding is plugged into
+ resources/
+ EchoBinding.composite - the SCA assembly used by the unit test
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Using Ant
+-----------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd binding-echo
+ant compile
+
+See the sample binding-echo-appl to run a sample that uses this binding.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd binding-echo
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoReferenceTestCase
+Returned message: foo
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.111 sec
+Running echo.EchoServiceTestCase
+Returned message: foo
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.121 sec
+
+Results :
+
+Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/build.xml
new file mode 100644
index 0000000000..b17fdc6bd5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/build.xml
@@ -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.
+-->
+<project name="bining-echo" default="compile">
+ <property name="test.jar" value="sample-binding-echo.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/pom.xml
new file mode 100644
index 0000000000..8ab5172bdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-binding-echo</artifactId>
+ <name>Apache Tuscany Echo Binding Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/DefaultEchoBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/DefaultEchoBindingFactory.java
new file mode 100644
index 0000000000..b27b936302
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/DefaultEchoBindingFactory.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 echo;
+
+import echo.impl.EchoBindingImpl;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public class DefaultEchoBindingFactory implements EchoBindingFactory {
+
+ public EchoBinding createEchoBinding() {
+ return new EchoBindingImpl();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBinding.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBinding.java
new file mode 100644
index 0000000000..446f720634
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBinding.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 echo;
+
+import org.apache.tuscany.sca.assembly.Binding;
+
+/**
+ * A model for the sample Echo binding.
+ */
+public interface EchoBinding extends Binding {
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBindingFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBindingFactory.java
new file mode 100644
index 0000000000..d893babb18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/EchoBindingFactory.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 echo;
+
+/**
+ * A factory for the sample Echo binding model.
+ */
+public interface EchoBindingFactory {
+
+ /**
+ * Creates a new Echo binding.
+ *
+ * @return a new Echi binding
+ */
+ EchoBinding createEchoBinding();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingImpl.java
new file mode 100644
index 0000000000..ef1629d519
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingImpl.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 echo.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingImpl implements EchoBinding {
+
+ private String name;
+ private String uri;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample binding does not support policies
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample binding does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample binding is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingProcessor.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingProcessor.java
new file mode 100644
index 0000000000..aba0b14d55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/impl/EchoBindingProcessor.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 echo.impl;
+
+import static org.osoa.sca.Constants.SCA_NS;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+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 echo.EchoBinding;
+import echo.EchoBindingFactory;
+
+/**
+ * A processor for <binding.echo> elements.
+ */
+public class EchoBindingProcessor implements StAXArtifactProcessor<EchoBinding> {
+
+ private QName BINDING_ECHO = new QName(SCA_NS, "binding.echo");
+
+ private final EchoBindingFactory factory;
+
+ public EchoBindingProcessor(EchoBindingFactory factory) {
+ this.factory = factory;
+ }
+
+ public QName getArtifactType() {
+ return BINDING_ECHO;
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+
+ public EchoBinding read(XMLStreamReader reader) throws ContributionReadException {
+ String uri = reader.getAttributeValue(null, "uri");
+ EchoBinding echoBinding = factory.createEchoBinding();
+ if (uri != null) {
+ echoBinding.setURI(uri.trim());
+ }
+ return echoBinding;
+ }
+
+ public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException {
+ }
+
+ public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/module/EchoModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/module/EchoModuleActivator.java
new file mode 100644
index 0000000000..268b903e54
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/module/EchoModuleActivator.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 echo.module;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+import echo.DefaultEchoBindingFactory;
+import echo.EchoBindingFactory;
+import echo.impl.EchoBindingProcessor;
+import echo.provider.EchoBindingProviderFactory;
+import echo.server.EchoServer;
+
+/**
+ * A module activator for the sample Echo binding extension.
+ */
+public class EchoModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // No extensionPoints being contributed here
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
+
+ // Create the Echo model factory
+ EchoBindingFactory echoFactory = new DefaultEchoBindingFactory();
+
+ // Add the EchoProcessor extension
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ EchoBindingProcessor echoBindingProcessor = new EchoBindingProcessor(echoFactory);
+ processors.addArtifactProcessor(echoBindingProcessor);
+
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new EchoBindingProviderFactory(messageFactory));
+
+ // Start the Echo server
+ EchoServer.start();
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ EchoServer.stop();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingInvoker.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingInvoker.java
new file mode 100644
index 0000000000..e3d52fa703
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingInvoker.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 echo.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+/**
+ * Interceptor for the sample echo binding.
+ */
+public class EchoBindingInvoker implements Invoker {
+
+ private Object echo(Object[] args) throws InvocationTargetException {
+ // echo back the result, a real binding would invoke some API for flowing the request
+ return args[0];
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object resp = echo((Object[])msg.getBody());
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ } catch (Throwable e) {
+ msg.setFaultBody(e);
+ }
+ return msg;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingProviderFactory.java
new file mode 100644
index 0000000000..623cb0e16e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoBindingProviderFactory.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 echo.provider;
+
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import echo.EchoBinding;
+
+
+/**
+ * Implementation of the Echo binding model.
+ */
+public class EchoBindingProviderFactory implements BindingProviderFactory<EchoBinding> {
+
+ private MessageFactory messageFactory;
+
+ public EchoBindingProviderFactory(MessageFactory messageFactory) {
+ this.messageFactory = messageFactory;
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) {
+ return new EchoReferenceBindingProvider(component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) {
+ return new EchoServiceBindingProvider(component, service, binding, messageFactory);
+ }
+
+ public Class<EchoBinding> getModelType() {
+ return EchoBinding.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoReferenceBindingProvider.java
new file mode 100644
index 0000000000..dd1a8f42f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoReferenceBindingProvider.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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+import echo.EchoBinding;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+public class EchoReferenceBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public EchoReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EchoBinding binding) {
+ this.reference = reference;
+ }
+
+ public Invoker createInvoker(Operation operation, boolean isCallback) {
+ if (isCallback) {
+ throw new UnsupportedOperationException();
+ } else {
+ return new EchoBindingInvoker();
+ }
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoServiceBindingProvider.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoServiceBindingProvider.java
new file mode 100644
index 0000000000..896e40df8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/provider/EchoServiceBindingProvider.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 echo.provider;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.apache.tuscany.sca.runtime.RuntimeWire;
+
+import echo.EchoBinding;
+import echo.server.EchoServer;
+import echo.server.EchoService;
+
+/**
+ * Implementation of the Echo binding provider.
+ */
+public class EchoServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponent component;
+ private RuntimeComponentService service;
+ private EchoBinding binding;
+ private MessageFactory messageFactory;
+
+ public EchoServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) {
+ this.component = component;
+ this.service = service;
+ this.binding = binding;
+ this.messageFactory = messageFactory;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return service.getInterfaceContract();
+ }
+
+ public void start() {
+
+ RuntimeComponentService componentService = (RuntimeComponentService) service;
+ RuntimeWire wire = componentService.getRuntimeWire(binding);
+ InvocationChain chain = wire.getInvocationChains().get(0);
+
+ // Register with the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().register(uri, new EchoService(chain.getHeadInvoker(), messageFactory));
+ }
+
+ public void stop() {
+
+ // Unregister from the hosting server
+ String uri = component.getURI() + "/" + binding.getName();
+ EchoServer.getServer().unregister(uri);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoServer.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoServer.java
new file mode 100644
index 0000000000..e1c88c38f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoServer.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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sample Echo server, showing how to integrate service bindings.
+ */
+public class EchoServer {
+
+ public static EchoServer server;
+
+ private Map<String, EchoService> services = new HashMap<String, EchoService>();
+
+ public static void start() {
+ server = new EchoServer();
+ }
+
+ public static void stop() {
+ server = null;
+ }
+
+ public static EchoServer getServer() {
+ return server;
+ }
+
+ /**
+ * Register a service under the given name.
+ *
+ * @param service
+ * @param name
+ */
+ public void register(String uri, EchoService service) {
+ services.put(uri, service);
+ }
+
+ public void unregister(String uri) {
+ services.remove(uri);
+ }
+
+ /**
+ * Dispatch an incoming interaction to the corresponding service.
+ *
+ * @param uri
+ * @param input
+ * @return
+ */
+ public String sendReceive(String uri, String input) throws InvocationTargetException {
+ return services.get(uri).sendReceive(input);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoService.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoService.java
new file mode 100644
index 0000000000..79593b2b6c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/java/echo/server/EchoService.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 echo.server;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.MessageFactory;
+
+/**
+ * The EchoService
+ */
+public class EchoService {
+ private Invoker invoker;
+ private MessageFactory messageFactory;
+
+ public EchoService(Invoker invoker, MessageFactory messageFactory) {
+ super();
+ this.invoker = invoker;
+ this.messageFactory = messageFactory;
+ }
+
+ public String sendReceive(String input) throws InvocationTargetException {
+
+ Message request = messageFactory.createMessage();
+ request.setBody(new Object[] {input});
+ // dispatch and get the response
+ Message response = invoker.invoke(request);
+ Object body = response.getBody();
+ if (response.isFault()) {
+ throw new InvocationTargetException((Throwable)body);
+ }
+ return (String)body;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..13d0d6f570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+echo.module.EchoModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/Echo.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/Echo.java
new file mode 100644
index 0000000000..1d5e973f33
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/Echo.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 echo;
+
+/**
+ * Interface of our sample Echo service.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Echo {
+
+ String echo(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoComponentImpl.java
new file mode 100644
index 0000000000..ba68dfe908
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoComponentImpl.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 echo;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * A simple client component that uses a reference with an Echo binding.
+ *
+ * @version $Rev$ $Date$
+ */
+public class EchoComponentImpl implements Echo {
+
+ private Echo echoReference;
+
+ @Constructor
+ public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public String echo(String msg) {
+ String result = echoReference.echo(msg);
+ System.out.println("Returned message: "+ result);
+ return result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoReferenceTestCase.java
new file mode 100644
index 0000000000..dc6a37c11f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoReferenceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Echo service;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ service = scaDomain.getService(Echo.class, "EchoComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() {
+ String result = service.echo("foo");
+ assertEquals(result, "foo");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoServiceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoServiceTestCase.java
new file mode 100644
index 0000000000..fafc112d01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/java/echo/EchoServiceTestCase.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 echo;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import echo.server.EchoServer;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoServiceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoBinding.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testEchoBinding() throws Exception {
+ String result = EchoServer.getServer().sendReceive("EchoComponent/EchoService", "foo");
+ assertEquals(result, "foo");
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/resources/EchoBinding.composite b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/resources/EchoBinding.composite
new file mode 100644
index 0000000000..7a792343f9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/binding-echo/src/test/resources/EchoBinding.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"
+ targetNamespace="http://echo"
+ xmlns:echo="http://echo"
+ name="EchoBinding">
+
+ <service name="EchoService" promote="EchoComponent">
+ <interface.java interface="echo.Echo"/>
+ <binding.echo uri="http://tempuri.org" />
+ </service>
+
+ <component name="EchoComponent">
+ <implementation.java class="echo.EchoComponentImpl"/>
+ </component>
+
+ <reference name="EchoReference" promote="EchoComponent/echoReference">
+ <interface.java interface="echo.Echo"/>
+ <binding.echo uri="http://tempuri.org" />
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/README b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/README
new file mode 100644
index 0000000000..f7c47328fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/README
@@ -0,0 +1,137 @@
+Calculator RMI Reference Sample
+===============================
+
+This sample illustrates the use of Tuscany RMI Binding to call reference
+services that are hosted as Java RMI services.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, first
+navigate to the calculator-rmi-service sample and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+Now you have the server running you need to open another command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+This sample extends the calculator sample by replacing the local wired
+connections with RMI bindings. Instead of local add, subtract, multiply and
+divide components a CalculatorServiceRmiImpl.java object now provides the
+add, subtract, multiple and divide interface and is hosted as an RMI server.
+References specified in the .composite file include an RMI binding which targets
+this RMI server.
+
+This sample adds a number of classes to the basic calculator sample:
+
+calculator-rmi-reference/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - as calculator sample
+ AddService.java - as calculator sample
+ SubtractService.java - as calculator sample
+ MultipleService.java - as calculator sample
+ DivideService.java - as calculator sample
+ CalculatorClient.java - as calculator sample
+ CalculatorServiceRmiImpl- implements the RMI server interface
+ that provides the target for the
+ RMI bindings in the composite
+ CalculatorServer.java - starts the Calculator Application
+ as a Java RMI Server. Running this class
+ keeps the Java RMI Server up an running
+ until the 'Enter Key' is pressed on the
+ console.
+ resources/
+ CalculatorRMIReference.composite - the SCA assembly for this sample
+ calculator-rmi-reference.png - a pictorial representation of the
+ .composite file
+ build.xml - the Ant build file for the client
+ pom.xml - the Maven build file
+
+Note. As this test creates and uses local network connections you may need to
+configure you firewall, if you are running one, to allow the test to run
+successfully.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Two
+build files are used to support client and server functions.
+
+The server provides an RMI server that the acts as a target for the SCA RMI
+bindings. Start a new console and use the following commands.
+
+cd calculator-rmi-service
+ant compile
+ant run
+
+This will run up the server and display the following.
+
+run:
+ [java] Calculator RMI Service bound to RMI Registry at port 8099...
+ [java] ...Press Enter to Exit...
+
+The client is very similar to the calculator sample. It starts the SCA runtime
+and calls each of the calculator operations. In doing this the RMI bindings
+make calls out the the RMI server you started in the previous step. Start
+a new console and use the following commands.
+
+cd calculator-rmi-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+If you now return to the console window running the server and press enter the
+server should stop.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-rmi-reference
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorRMIReferenceTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.308 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/build.xml
new file mode 100644
index 0000000000..30817fe6f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/build.xml
@@ -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.
+-->
+<project name="calculator-rmi-reference-client" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator-rmi-reference.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.png b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.png
new file mode 100644
index 0000000000..8c76b77a9f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.svg b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.svg
new file mode 100644
index 0000000000..ba802e6717
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/calculator-rmi-reference.svg
@@ -0,0 +1,412 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-reference"
+ sodipodi:docname="calculator-rmi-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-reference\calculator-rmi-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="553.58838"
+ inkscape:cy="368.42498"
+ inkscape:document-units="px"
+ inkscape:current-layer="g2997"
+ inkscape:window-width="1134"
+ inkscape:window-height="721"
+ inkscape:window-x="1"
+ inkscape:window-y="105" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.679966,0,0,1.144214,82.34853,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.2674253;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="matrix(1.365843,0,0,1,-103.2086,0)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="773.32635"
+ y="331.87738"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(498.7355,125.2248)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Calculator</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">RMI</flowPara><flowPara
+ id="flowPara2004">Impl</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.77069,220.86752 L 630.65876,220.86752 L 642.09292,246.48812 L 628.75306,270.13795 L 567.77069,270.13795 L 582.06342,246.48812 L 567.77069,220.86752 z "
+ id="path1913" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1950"
+ transform="translate(301.0221,17.10977)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1952"><rect
+ id="rect1954"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1958">Add</flowPara><flowPara
+ id="flowPara1962">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.83889,304.45927 L 630.72696,304.45927 L 642.16112,330.07987 L 628.82126,353.7297 L 567.83889,353.7297 L 582.13162,330.07987 L 567.83889,304.45927 z "
+ id="path1964" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1966"
+ transform="translate(301.0903,100.7015)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1968"><rect
+ id="rect1970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1972">Subtract</flowPara><flowPara
+ id="flowPara1974">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.1246,382.31641 L 630.01267,382.31641 L 641.44683,407.93701 L 628.10697,431.58684 L 567.1246,431.58684 L 581.41733,407.93701 L 567.1246,382.31641 z "
+ id="path1976" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1978"
+ transform="translate(300.376,178.5587)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1980"><rect
+ id="rect1982"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1984">Multiply</flowPara><flowPara
+ id="flowPara1986">Reference</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 569.98175,459.45927 L 632.86982,459.45927 L 644.30398,485.07987 L 630.96412,508.7297 L 569.98175,508.7297 L 584.27448,485.07987 L 569.98175,459.45927 z "
+ id="path1988" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1990"
+ transform="translate(303.2332,255.7015)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1992"><rect
+ id="rect1994"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1996">Divide</flowPara><flowPara
+ id="flowPara1998">Reference</flowPara></flowRoot> <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path2000"
+ sodipodi:cx="736.78571"
+ sodipodi:cy="361.95163"
+ sodipodi:rx="39.642857"
+ sodipodi:ry="38.57143"
+ d="M 758.87546,329.92324 A 39.642857,38.57143 0 1 1 757.94075,329.33134"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-22.42857,4.142857)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2006"
+ transform="translate(411.7392,139.0467)"><flowRegion
+ id="flowRegion2008"><rect
+ id="rect2010"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2016">RMI</flowPara><flowPara
+ id="flowPara2018">Registry</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 642.14286,246.23734 L 692.85714,333.3802"
+ id="path2027" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 640.71429,330.52305 L 677.14286,350.52305"
+ id="path2029" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 640.71429,408.3802 L 677.85714,382.66591"
+ id="path2031" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 645,484.80877 L 693.57143,400.52305"
+ id="path2033" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 753.57143,366.95163 L 773.57143,366.95163"
+ id="path2035" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2037"
+ transform="translate(385.3078,69.25256)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2039"><rect
+ id="rect2041"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2045">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2059"
+ transform="translate(371.9396,116.0363)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2061"><rect
+ id="rect2063"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2065">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2067"
+ transform="translate(366.9396,168.8935)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2069"><rect
+ id="rect2071"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2073">RMI</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2075"
+ transform="translate(376.9396,209.6077)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2077"><rect
+ id="rect2079"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2081">RMI</flowPara></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/pom.xml
new file mode 100644
index 0000000000..c82c23cddd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-rmi-reference</artifactId>
+ <name>Apache Tuscany Calculator Sample using an RMI Service Reference</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..ec57a6a533
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..cd1076c3f1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..08cba76467
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorService.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 calculator;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService extends Remote {
+
+ double add(double n1, double n2) throws RemoteException;
+
+ double subtract(double n1, double n2) throws RemoteException;
+
+ double multiply(double n1, double n2) throws RemoteException;
+
+ double divide(double n1, double n2) throws RemoteException;
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..f28f0ca179
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/CalculatorServiceImpl.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 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..835e4fda6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/MultiplyService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..30e4e6a56a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/java/calculator/SubtractService.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 calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.composite
new file mode 100644
index 0000000000..20dce0ec28
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/main/resources/CalculatorRMIReference.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"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService">
+ <binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="subtractService">
+ <binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="multiplyService">
+ <binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ <reference name="divideService">
+ <binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </reference>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.java
new file mode 100644
index 0000000000..554872a8b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIReferenceTestCase.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 calculator;
+
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorRMIReferenceTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ CalculatorRMIServiceImpl rmiCalculatorImpl = new CalculatorRMIServiceImpl();
+ Registry rmiRegistry = LocateRegistry.createRegistry(8099);
+ rmiRegistry.bind("CalculatorRMIService", rmiCalculatorImpl);
+
+ scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ LocateRegistry.getRegistry(8099).unbind("CalculatorRMIService");
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.java
new file mode 100644
index 0000000000..d8ded42cb2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-reference/src/test/java/calculator/CalculatorRMIServiceImpl.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 calculator;
+
+import java.rmi.RemoteException;
+import java.rmi.server.UnicastRemoteObject;
+
+
+
+/**
+ * An implementation of the Calculator service.
+ */
+public class CalculatorRMIServiceImpl extends UnicastRemoteObject implements CalculatorService {
+
+ private static final long serialVersionUID = -1543948944662001428L;
+
+ public CalculatorRMIServiceImpl() throws RemoteException {
+ super();
+ }
+
+ public double add(double n1, double n2) throws RemoteException {
+ return n1 + n2;
+ }
+
+ public double subtract(double n1, double n2) {
+ return n1 - n2;
+ }
+
+ public double multiply(double n1, double n2) {
+ return n1 * n2;
+ }
+
+ public double divide(double n1, double n2) {
+ return n1 / n2;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/README b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/README
new file mode 100644
index 0000000000..016ebf5668
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/README
@@ -0,0 +1,137 @@
+Calculator RMI Service Sample
+===============================
+
+This sample illustrates the use of Tuscany RMI Binding to expose component
+services as Java RMI Services. It also demonstrates how a simple Java RMI
+Client application invoke the SCA Application's services exposed as RMI
+Services.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-service.jar calculator.CalculatorServer
+
+Now you have the server running you need to open another command prompt, navigate
+to the calculator-rmi-reference sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-rmi-reference.jar calculator.CalculatorClient
+
+
+Sample Overview
+---------------
+This sample extends the calculator sample by replacing the local service
+binding with an RMI binding. SO a java client can call the service exposed
+by the SCA application using an RMI client.
+
+This sample adds a number of classes to the basic calculator sample:
+
+calculator-rmi-service/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - as calculator sample
+ AddService.java - as calculator sample
+ SubtractService.java - as calculator sample
+ MultipleService.java - as calculator sample
+ DivideService.java - as calculator sample
+ CalculatorClient.java - Uses the java naming service to
+ look up the Calculator RMI service.
+ It then calls add, subtract, multiple
+ and divide methods on the service
+ CalculatorServer.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ In doing this the SCA RMI binding
+ acts to expose the CalculatorService
+ over RMI.
+ resources/
+ CalculatorRMIServer.composite - the SCA assembly for this sample
+ calculator-rmi-service.png - a pictorial representation of the
+ .composite file
+ build.xml - the Ant build file for the server
+ pom.xml - the Maven build file
+
+Note. As this test creates and uses local network connections you may need to
+configure you firewall, if you are running one, to allow the test to run
+successfully.
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Two
+build files are used to support client and server functions.
+
+The server starts the SCA runtime and loads the SCA calculator application
+which exposes an RMI service. Start a new console and use the following
+commands.
+
+cd calculator-rmi-service
+ant compile
+ant run
+
+This will run up the server and display the following.
+
+run:
+ [java] Calculator RMI Service bound to RMI Registry at port 8099...
+ [java] ...Press Enter to Exit...
+
+The client is very similar to the calculator sample
+
+It locates the RMI service that the SCA runtime is exposing and calls each of
+the calculator operations. Start a new console and use the following commands.
+
+cd calculator-rmi-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+If you now return to the console window running the server and press enter the
+server should stop.
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-rmi-service
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorRMIServerTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.819 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/build.xml
new file mode 100644
index 0000000000..f98f35e4b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/build.xml
@@ -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.
+-->
+<project name="calculator-rmi-service-server" default="compile">
+ <property name="test.class" value="calculator.CalculatorServer" />
+ <property name="test.jar" value="sample-calculator-rmi-service.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.png b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.png
new file mode 100644
index 0000000000..574f5eb14b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.svg b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.svg
new file mode 100644
index 0000000000..9253110f98
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/calculator-rmi-service.svg
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-service"
+ sodipodi:docname="calculator-rmi-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-rmi-service\calculator-rmi-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="186"
+ inkscape:window-y="165" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara><flowPara
+ id="flowPara1950">(RMI)</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/pom.xml
new file mode 100644
index 0000000000..280f6e03ce
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-rmi-service</artifactId>
+ <name>Apache Tuscany Calculator Sample exposing as RMI Service</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-rmi</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..ec57a6a533
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9c635e3c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..2b99485b68
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import java.rmi.Naming;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+ CalculatorService calculatorService = (CalculatorService)Naming.lookup("//localhost:8099/CalculatorRMIService");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.java
new file mode 100644
index 0000000000..f603f914b8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServer.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 org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A claculator service server. Starts up the SCA runtime which
+ * will start listening for RMI service requests.
+ */
+public class CalculatorServer {
+ public static void main(String[] args) throws Exception {
+ System.out.println("Starting the SCA Calculator Application exposed as RMI Services...");
+ SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIServer.composite");
+ System.out.println("... Press Enter to Exit...");
+ System.in.read();
+ scaDomain.close();
+ System.out.println("Exited...");
+ System.exit(0);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..978d2c6f42
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorService.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 calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..f28f0ca179
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/CalculatorServiceImpl.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 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..835e4fda6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..30e4e6a56a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractService.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 calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1a7f145ad8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.composite
new file mode 100644
index 0000000000..85e2dc4135
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/main/resources/CalculatorRMIServer.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"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <service name="CalculatorService">
+ <interface.java interface="calculator.CalculatorService"/>
+ <binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService"/>
+ </service>
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"></reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.java
new file mode 100644
index 0000000000..67300bd99e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-rmi-service/src/test/java/calculator/CalculatorRMIServerTestCase.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 calculator;
+
+import java.rmi.Naming;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorRMIServerTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("CalculatorRMIServer.composite");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalculator() throws Exception {
+ // Calculate
+ calculatorService = (CalculatorService)Naming.lookup("//localhost:8099/CalculatorRMIService");
+ 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/README b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/README
new file mode 100644
index 0000000000..ce471ebddc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/README
@@ -0,0 +1,100 @@
+Calculator Script Sample
+========================
+This sample implements a simple calculator using SCA components implemented
+using Java, JavaScript, Ruby, Python and Groovy.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-script.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-script.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing
+to the appropriate components in the composite across the local wires. Each
+component is implemented using a different language.
+
+calculator-script/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component calls +-/* as
+ appropriate
+ AddService.java - adds two numbers
+ SubtractService.java - subtracts one number from another
+ MultipleService.java - multiplies two numbers
+ DivideService.java - divides one number by another
+ CalculatorClient.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ It then calls the deployed Calculator
+ Components services
+ resources/
+ calculator/
+ AddServiceImpl.js - A JavaScript implementation of the
+ Add component
+ SubtractServiceImpl.rb - A Ruby implementation of the Subtract
+ component
+ MultiplyServiceImpl.py - A Python implementation of the
+ Multiple component
+ DivideServiceImpl.groovy- A Groovy implementation of the
+ Divide component
+ Calculator.composite - the SCA assembly for this sample
+
+ calculator-script.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator-script
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-script
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.918 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/build.xml
new file mode 100644
index 0000000000..429d638ca5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/build.xml
@@ -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.
+-->
+<project name="calculator-script" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator-script.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.png b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.png
new file mode 100644
index 0000000000..d3f8c491c3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.svg b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.svg
new file mode 100644
index 0000000000..16939f9310
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/calculator-script.svg
@@ -0,0 +1,334 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-script"
+ sodipodi:docname="calculator-script.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-script\calculator-script.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara><flowPara
+ id="flowPara1950">(Java)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara><flowPara
+ id="flowPara1952">(Javascript)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara><flowPara
+ id="flowPara1954">(Ruby)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara><flowPara
+ id="flowPara1956">(Python)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara><flowPara
+ id="flowPara1958">(Groovy)</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/pom.xml
new file mode 100644
index 0000000000..d86c5c8ce4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-script</artifactId>
+ <name>Apache Tuscany Calculator Sample implemented using scripting languages</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..a235e648c7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..243d1562dc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..c89043276e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorService.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 calculator;
+
+/**
+ * The Calculator service interface.
+ */
+public interface CalculatorService {
+
+ double add(double n1, double n2);
+
+ double subtract(double n1, double n2);
+
+ double multiply(double n1, double n2);
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..ba897fa301
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.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 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..497dafd4fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/MultiplyService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..376b3e5bb9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/java/calculator/SubtractService.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 calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..fce26f940f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/Calculator.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"
+ name="Calculator">
+
+ <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.script script="calculator/AddServiceImpl.js"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.script script="calculator/SubtractServiceImpl.rb"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.script script="calculator/MultiplyServiceImpl.py"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.script script="calculator/DivideServiceImpl.groovy"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.componentType
new file mode 100644
index 0000000000..8746c26a76
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.componentType
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="calculator.AddService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
new file mode 100644
index 0000000000..1d4d221364
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 add(n1, n2) {
+ return n1 + n2;
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.componentType
new file mode 100644
index 0000000000..76798fab3c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.componentType
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="calculator.DivideService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
new file mode 100644
index 0000000000..c31c1e8fd6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+def divide(n1, n2) {
+ return n1 / n2
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.componentType
new file mode 100644
index 0000000000..34c50c7aa5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.componentType
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="calculator.MultiplyService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
new file mode 100644
index 0000000000..d6f27ca7f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+def multiply(n1, n2):
+ return n1 * n2 \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.componentType b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.componentType
new file mode 100644
index 0000000000..0edf77d4fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.componentType
@@ -0,0 +1,30 @@
+<?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"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+ <service name="HelloWorldService">
+ <interface.java interface="calculator.SubtractService" />
+ </service>
+
+</componentType>
+ \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
new file mode 100644
index 0000000000..132a1d13b0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
@@ -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.
+#
+
+def subtract(n1, n2)
+ return n1 - n2
+end \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..c174cf7ed9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.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 calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/README b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/README
new file mode 100644
index 0000000000..28f1f80abb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/README
@@ -0,0 +1,93 @@
+Calculator Sample
+=================
+This sample uses the same code as the calculator sample but deploys the
+sample wrapped in a web app.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-calculator-web.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-web
+
+The port and hostname will of course vary depending on your local installation.
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite across the local wires.
+
+calculator-web/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - As calculator sample
+ AddService.java - As calculator sample
+ SubtractService.java - As calculator sample
+ MultipleService.java - As calculator sample
+ DivideService.java - As calculator sample
+ CalculatorClient.java - As calculator sample
+ resources/
+ Calculator.composite - As calculator sample
+ webapp
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ calc.jsp - the web application that makes use of the
+ SCA application
+
+ calculator.png - a pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd calculator-web
+ant package
+
+This should result in a war file (sample-calculator-web.war) in the target
+directory. Copy this war file to your web app deployment directory in you
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-calculator-web/calc.jsp
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see the following output.
+
+Expression Result
+2 + 3 5.0
+3 - 2 1.0
+3 * 2 6.0
+3 / 2 1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator-web
+mvn
+
+Again this should result in a war file (sample-calculator-web.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/build.xml
new file mode 100644
index 0000000000..aa826ef036
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/build.xml
@@ -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.
+-->
+<project name="calculator-web" default="package">
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ </target>
+
+ <target name="package" depends="compile">
+ <war destfile="target/sample-calculator-web.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <zipfileset dir="../../modules" prefix="WEB-INF/lib">
+ <include name="sca-api-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-assembly-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-assembly-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-contribution-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-contribution-impl-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-databinding-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-spi-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-databinding-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-embedded-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-http-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-webapp-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-policy-0.90-incubating-SNAPSHOT.jar"/>
+ </zipfileset>
+ <lib dir="../../lib">
+ <include name="commonj-api-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="stax-api-1.0.1.jar"/>
+ <include name="wsdl4j-1.6.2.jar"/>
+ <include name="wstx-asl-3.2.0.jar"/>
+ <include name="XmlSchema-1.3.1.jar"/>
+ <include name="**/../../modules/*.jar"/>
+ </lib>
+ <classes dir="target/classes"/>
+ </war>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.png b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.png
new file mode 100644
index 0000000000..896ddc4093
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.svg b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.svg
new file mode 100644
index 0000000000..00ed27556f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/calculator-web.svg
@@ -0,0 +1,358 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-web"
+ sodipodi:docname="calculator-web.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator-web\calculator-web.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ <path
+ sodipodi:type="arc"
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="path1950"
+ sodipodi:cx="179.28572"
+ sodipodi:cy="352.66592"
+ sodipodi:rx="32.857143"
+ sodipodi:ry="35"
+ d="M 197.59435,323.60313 A 32.857143,35 0 1 1 196.81963,323.06603"
+ sodipodi:start="5.3034219"
+ sodipodi:end="11.558474"
+ sodipodi:open="true"
+ transform="translate(-12.85714,0.714286)" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(-142.5493,128.5383)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1960">WebApp</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 235,356.23734 C 200.71429,356.23734 200.71429,356.23734 200.71429,356.23734"
+ id="path1972" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/pom.xml
new file mode 100644
index 0000000000..7a5ea1dd2d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator-web</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany Calculator Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..ec57a6a533
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * The interface for the add service
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..e9c635e3c8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..4787b728f4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ *
+ * (not really necessary as this sample runs in a webapp)
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..ad87375529
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..bf3b0303ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/CalculatorServiceImpl.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 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..835e4fda6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * The interface for the divide service
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..8c33862f6d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..db568cc762
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..c7fbc73c00
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..30e4e6a56a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractService.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 calculator;
+
+/**
+ * The interface for the subtract service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..1a7f145ad8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..785984fd55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/resources/Calculator.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"
+ name="Calculator">
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"></reference>
+ <reference name="subtractService" target="SubtractServiceComponent"></reference>
+ <reference name="multiplyService" target="MultiplyServiceComponent"></reference>
+ <reference name="divideService" target="DivideServiceComponent"></reference>
+ </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/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..048c4c125c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/META-INF/sca-contribution.xml
@@ -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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
+ <deployable composite="Calculator"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..e596b2bc39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<!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>Tuscany Calculator Web Service Sample</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>calc.jsp</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+</web-app>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/calc.jsp b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/calc.jsp
new file mode 100644
index 0000000000..375116e5de
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/main/webapp/calc.jsp
@@ -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.
+--%>
+
+<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%>
+<%@ page import="calculator.CalculatorService" %>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain");
+ CalculatorService calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+%>
+<html>
+<head><title>Calculator sample</title></head>
+
+<body>
+<table>
+ <tr>
+ <th>Expression</th><th>Result</th>
+ </tr>
+ <tr>
+ <td>2 + 3</td><td><%= calculatorService.add(2, 3) %></td>
+ </tr>
+ <tr>
+ <td>3 - 2</td><td><%= calculatorService.subtract(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 * 2</td><td><%= calculatorService.multiply(3, 2) %></td>
+ </tr>
+ <tr>
+ <td>3 / 2</td><td><%= calculatorService.divide(3, 2) %></td>
+ </tr>
+</table>
+</body>
+</html>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..65b8646d4d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator-web/src/test/java/calculator/CalculatorTestCase.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 calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CalculatorService calculatorService;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/README b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/README
new file mode 100644
index 0000000000..fbc79e0383
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/README
@@ -0,0 +1,88 @@
+Calculator Sample
+=================
+This sample implements a simple calculator using SCA components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient
+
+Sample Overview
+---------------
+The sample provides a single calculator service with a default SCA (java)
+binding. The CalculatorClient exercises this interface by calling add,
+subtract, multiply and divide operations. This results in messages passing to
+the appropriate components in the composite across the local wires.
+
+calculator/
+ src/
+ main/
+ java/
+ calculator/
+ CalculatorService.java - the first component, calls +-/* as
+ appropriate
+ AddService.java - adds two numbers
+ SubtractService.java - subtracts one number from another
+ MultipleService.java - multiplies two numbers
+ DivideService.java - divides one number by another
+ CalculatorClient.java - starts the SCA Runtime and
+ deploys the Calculator.composite.
+ It then calls the deployed Calculator
+ Components services
+ resources/
+ Calculator.composite - the SCA assembly for this sample
+ calculator.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] 3 + 2=5.0
+ [java] 3 - 2=1.0
+ [java] 3 * 2=6.0
+ [java] 3 / 2=1.5
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd calculator
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running calculator.CalculatorTestCase
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/build.xml
new file mode 100644
index 0000000000..c4b755ef94
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/build.xml
@@ -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.
+-->
+<project name="calculator" default="compile">
+ <property name="test.class" value="calculator.CalculatorClient" />
+ <property name="test.jar" value="sample-calculator.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.png b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.png
new file mode 100644
index 0000000000..995a57b1fd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.svg b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.svg
new file mode 100644
index 0000000000..0615925c50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/calculator.svg
@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator"
+ sodipodi:docname="calculator.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\calculator\calculator.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="471.80491"
+ inkscape:cy="378.84265"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="59"
+ inkscape:window-y="79" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1,0,0,1.144214,0,-27.53557)">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.86971939;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">Calculator</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.9999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="191.57716"
+ x="339.91632"
+ y="262.1673"
+ rx="6.9961648"
+ ry="15.892869" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(79.61125,62.65764)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Calculator</flowPara><flowPara
+ id="flowPara1895">Service</flowPara><flowPara
+ id="flowPara1897">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.01809,321.46204 L 471.00147,321.46204 L 478.27117,334.59402 L 469.78986,346.71586 L 431.01809,346.71586 L 440.10523,334.59402 L 431.01809,321.46204 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 223.15923,328.61046 L 282.4833,328.61046 L 293.26948,355.48529 L 280.68561,380.29286 L 223.15923,380.29286 L 236.64198,355.48529 L 223.15923,328.61046 z "
+ id="path1883" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(-46.16225,128.7269)"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-family:Bitstream Vera Sans;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-size:11;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%" /></flowRegion><flowPara
+ id="flowPara1891">Calculator</flowPara><flowPara
+ id="flowPara1893">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1899"
+ width="115.66247"
+ height="70.148659"
+ x="594.75488"
+ y="209.73451"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1901"
+ transform="translate(334.4498,10.22481)"><flowRegion
+ id="flowRegion1903"><rect
+ id="rect1905"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1907">Add</flowPara><flowPara
+ id="flowPara1909">Service</flowPara><flowPara
+ id="flowPara1911">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.31867,232.29606 L 606.65371,232.29606 L 612.71462,245.42804 L 605.64356,257.54988 L 573.31867,257.54988 L 580.89482,245.42804 L 573.31867,232.29606 z "
+ id="path1913" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1917"
+ width="115.66247"
+ height="70.148659"
+ x="594.06543"
+ y="292.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1919"
+ transform="translate(333.7604,93.08188)"><flowRegion
+ id="flowRegion1921"><rect
+ id="rect1923"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1925">Subtract</flowPara><flowPara
+ id="flowPara1927">Service</flowPara><flowPara
+ id="flowPara1929">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 572.62924,315.15313 L 605.96428,315.15313 L 612.02519,328.28511 L 604.95413,340.40695 L 572.62924,340.40695 L 580.20539,328.28511 L 572.62924,315.15313 z "
+ id="path1931" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1933"
+ width="115.66247"
+ height="70.148659"
+ x="594.77979"
+ y="371.87729"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1935"
+ transform="translate(334.4747,172.3676)"><flowRegion
+ id="flowRegion1937"><rect
+ id="rect1939"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1941">Multiply</flowPara><flowPara
+ id="flowPara1943">Service</flowPara><flowPara
+ id="flowPara1945">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 573.34352,394.43884 L 606.67856,394.43884 L 612.73947,407.57082 L 605.66841,419.69266 L 573.34352,419.69266 L 580.91967,407.57082 L 573.34352,394.43884 z "
+ id="path1947" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1949"
+ width="115.66247"
+ height="70.148659"
+ x="596.20831"
+ y="452.59158"
+ rx="6.9961648"
+ ry="5.8193965" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1951"
+ transform="translate(335.9032,253.0819)"><flowRegion
+ id="flowRegion1953"><rect
+ id="rect1955"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1957">Divide</flowPara><flowPara
+ id="flowPara1959">Service</flowPara><flowPara
+ id="flowPara1961">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 574.77209,475.15313 L 608.10713,475.15313 L 614.16804,488.28511 L 607.09698,500.40695 L 574.77209,500.40695 L 582.34824,488.28511 L 574.77209,475.15313 z "
+ id="path1963" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1965"
+ transform="translate(161.0221,114.967)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1967"><rect
+ id="rect1969"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1973">add</flowPara><flowPara
+ id="flowPara1977">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 430.65917,357.18186 L 470.64255,357.18186 L 477.91225,370.31384 L 469.43094,382.43568 L 430.65917,382.43568 L 439.74631,370.31384 L 430.65917,357.18186 z "
+ id="path1979" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1981"
+ transform="translate(160.6632,150.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1983"><rect
+ id="rect1985"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1987">subtract</flowPara><flowPara
+ id="flowPara1989">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 431.37346,390.75329 L 471.35684,390.75329 L 478.62654,403.88527 L 470.14523,416.00711 L 431.37346,416.00711 L 440.4606,403.88527 L 431.37346,390.75329 z "
+ id="path1991" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1993"
+ transform="translate(161.3775,184.2583)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1995"><rect
+ id="rect1997"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1999">multiply</flowPara><flowPara
+ id="flowPara2001">Service</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999982px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 429.94489,422.18186 L 469.92827,422.18186 L 477.19797,435.31384 L 468.71666,447.43568 L 429.94489,447.43568 L 439.03203,435.31384 L 429.94489,422.18186 z "
+ id="path2003" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2005"
+ transform="translate(159.9489,215.6868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2007"><rect
+ id="rect2009"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:100%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara2011">divide</flowPara><flowPara
+ id="flowPara2013">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,335.52305 L 511.42857,335.52305 L 510.71429,245.52305 L 579.28571,245.52305"
+ id="path2015" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.85714,369.80877 L 528.57143,369.80877 L 528.57143,329.80877 L 580,329.80877"
+ id="path2017" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 478.57143,402.66591 L 528.57143,401.95163 L 528.57143,408.3802 L 580,407.66591"
+ id="path2019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475.71429,435.52305 L 509.28571,435.52305 L 510,486.95163 L 582.14286,486.23734"
+ id="path2021" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 292.85714,355.52305 L 330,354.80877"
+ id="path2023" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/pom.xml
new file mode 100644
index 0000000000..066b6ed3cb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-calculator</artifactId>
+ <name>Apache Tuscany Calculator Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddService.java
new file mode 100644
index 0000000000..188451ebac
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddService.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 calculator;
+
+/**
+ * The Add service interface
+ */
+public interface AddService {
+
+ double add(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/AddServiceImpl.java
new file mode 100644
index 0000000000..8b6fe066a6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorClient.java
new file mode 100644
index 0000000000..9d180bf52e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorClient.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 calculator;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class CalculatorClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
+
+ CalculatorService calculatorService =
+ scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+
+ // Calculate
+ System.out.println("3 + 2=" + calculatorService.add(3, 2));
+ System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
+ System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
+ System.out.println("3 / 2=" + calculatorService.divide(3, 2));
+
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorService.java
new file mode 100644
index 0000000000..031fa8b912
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java
new file mode 100644
index 0000000000..3d861f2018
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideService.java
new file mode 100644
index 0000000000..30d248208b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideService.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 calculator;
+
+/**
+ * The divide service interface
+ */
+public interface DivideService {
+
+ double divide(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/DivideServiceImpl.java
new file mode 100644
index 0000000000..f7ac0b7287
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyService.java
new file mode 100644
index 0000000000..5290605938
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface MultiplyService {
+
+ double multiply(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java
new file mode 100644
index 0000000000..b7dca792b2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractService.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractService.java
new file mode 100644
index 0000000000..bf0d1882b6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractService.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 calculator;
+
+/**
+ * The interface for the multiply service
+ */
+public interface SubtractService {
+
+ double subtract(double n1, double n2);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java
new file mode 100644
index 0000000000..77b128ab8d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/resources/Calculator.composite b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/resources/Calculator.composite
new file mode 100644
index 0000000000..f8655c04fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/main/resources/Calculator.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"
+ name="Calculator">
+
+ <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/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/test/java/calculator/CalculatorTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/test/java/calculator/CalculatorTestCase.java
new file mode 100644
index 0000000000..8da7097149
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/calculator/src/test/java/calculator/CalculatorTestCase.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 calculator;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+public class CalculatorTestCase extends TestCase {
+
+ private CalculatorService calculatorService;
+ private SCADomain scaDomain;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("Calculator.composite");
+ calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ 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/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/README b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/README
new file mode 100644
index 0000000000..70a98171cc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/README
@@ -0,0 +1,140 @@
+DataBinding Echo Sample
+=======================
+
+This sample demonstrates how databindings are used to convert data formats as
+the data flows between components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt, navigate
+to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo\target\sample-binding-echo.jar;target\sample-databinding-echo.jar dbecho.EchoDataBindingClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo/target/sample-binding-echo.jar:target/sample-databinding-echo.jar dbecho.EchoDataBindingClient
+
+
+Sample Overview
+---------------
+If reference and service interfaces are the same in all but the formats of
+data being passed to and returned from the operations of the interfaces,
+then SCA will try to apply appropriate transformations to the data formats
+to allow messages to pass.
+
+This sample shows this happening. ComponentA implements Interface1 which
+defines;
+
+ String call(String msg)
+ String call1(String msg)
+
+ComponentA defines a reference to ComponentB with Interface1. ComponentB
+however implements Interface2 which defines;
+
+ Node call(Node msg);
+ XMLStreamReader call1(XMLStreamReader msg);
+
+You can see from the test output below that SCA converts the call() msg from a
+String to a DOM object (org.apache.xerces.dom.DeferredDocumentImpl). It
+converts the call1() msg from a String to a XML stream reader
+(com.ctc.wstx.sr.ValidatingStreamReader).
+
+databinding-echo/
+ src/
+ main/
+ java/
+ dbecho/
+ ComponentAImpl.java - component implementation
+ ComponentBImpl.java - component implementation
+ Echo.java - service interface with data binding
+ EchoDataBindingClient.java - sample client code
+ Interface1.java - service interface with data binding
+ Interface2.java - service interface with data bindings
+ resources/
+ EchoDataBinding.composite - composite definition
+ wsdl/
+ echo.wsdl - WSDL deinitions
+ test/
+ java/
+ dbecho/
+ EchoDataBindingTestCase.java - junit test case
+ databinding-echo.png - pictorial representation of the sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+TODO - Needs more description of what else is going on in this test
+ properties, wsdl?
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows.
+
+cd databinding-echo
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] [Property] prefix: ABC
+ [java] [Property] prefix1: ABC
+ [java] [Property] bar: BAR
+ [java] ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ [java] ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ [java] ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ [java] ComponentA --> Returned message: <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message> [java.lang.String]
+ [java] [Property] prefix: ABC
+ [java] [Property] prefix1: ABC
+ [java] [Property] bar: BAR
+ [java] ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ [java] ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader]
+ [java] ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader]
+ [java] ComponentA --> Returned message: <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message> [java.lang.String]
+ [java] call response = <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message>
+ [java] call1 response = <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message>
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd databinding-echo
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running echo.EchoDataBindingTestCase
+[Property] prefix: ABC
+[Property] prefix1: ABC
+[Property] bar: BAR
+ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl]
+ComponentA --> Returned message: <?xml version="1.0" encoding="UTF-8"?><message><foo>123</foo></message> [java.lang.String]
+[Property] prefix: ABC
+[Property] prefix1: ABC
+[Property] bar: BAR
+ComponentA --> Received message: <message><foo>123</foo></message> [java.lang.String]
+ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader]
+ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader]
+ComponentA --> Returned message: <?xml version='1.0' encoding='UTF-8'?><message><foo>123</foo></message> [java.lang.String]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.653 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/build.xml
new file mode 100644
index 0000000000..c70f429afd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/build.xml
@@ -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.
+-->
+<project name="databinding-echo" default="compile">
+ <property name="test.class" value="dbecho.EchoDataBindingClient" />
+ <property name="test.jar" value="sample-databinding-echo.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ <pathelement location="../binding-echo/target/sample-binding-echo.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.png b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.png
new file mode 100644
index 0000000000..afbbfff285
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.svg b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.svg
new file mode 100644
index 0000000000..87964abf86
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/databinding-echo.svg
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\databinding-echo"
+ sodipodi:docname="databinding-echo.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\databinding-echo\databinding-echo.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="651.92601"
+ inkscape:cy="392.43347"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="129"
+ inkscape:window-y="144" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(-1.428571,-2.857143)">
+ <rect
+ rx="12.858844"
+ ry="14.71703"
+ y="192.00235"
+ x="258.31155"
+ height="347.85706"
+ width="416.42877"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">EchoDataBinding</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1883"
+ width="115.66247"
+ height="85.862968"
+ x="383.82632"
+ y="385.59885"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(116.2356,179.6603)"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1891">ComponentB</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 362.67592,417.44582 L 408.70328,417.44582 L 417.07188,430.5778 L 407.30852,442.69964 L 362.67592,442.69964 L 373.13669,430.5778 L 362.67592,417.44582 z "
+ id="path1895" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 479.92825,415.60754 L 513.26329,415.60754 L 519.3242,428.73952 L 512.25314,440.86136 L 479.92825,440.86136 L 487.5044,428.73952 L 479.92825,415.60754 z "
+ id="path1897" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 530.71429,300.52305 C 542.23557,306.08282 554.6675,310.12484 560.71429,324.80877 C 566.71449,361.72815 311.41635,367.01996 323.57143,396.95162 C 328.25255,419.41336 352.58793,422.22083 371.42857,430.52305"
+ id="path1985"
+ sodipodi:nodetypes="cccc" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 636.0161,399.32486 L 697.75773,399.32486 L 708.98347,428.79969 L 695.88678,456.00726 L 636.0161,456.00726 L 650.0483,428.79969 L 636.0161,399.32486 z "
+ id="path1987" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="385.63062"
+ y="257.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(120.1827,59.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">ComponentA</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="58.861061"
+ height="43.565228"
+ x="413.73505"
+ y="225.79604"
+ rx="29.430531"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 368.48016,289.0146 L 412.69432,289.0146 L 420.73325,302.14658 L 411.3545,314.26842 L 368.48016,314.26842 L 378.52884,302.14658 L 368.48016,289.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 477.44718,289.31918 L 522.26576,289.31918 L 530.41458,302.45116 L 520.90763,314.573 L 477.44718,314.573 L 487.63323,302.45116 L 477.44718,289.31918 z "
+ id="path3019" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1929"
+ transform="translate(137.8698,15.88564)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1931"><rect
+ id="rect1933"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1939">prefix</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1946">prefix1</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1948">bar</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1950" /></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1952"
+ transform="translate(206.8091,83.74868)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1954"><rect
+ id="rect1956"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1964">Interface1</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1975"
+ transform="translate(90.30101,207.3812)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1977"><rect
+ id="rect1979"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1981">Interface2</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1989"
+ transform="translate(366.1555,195.5999)"><flowRegion
+ id="flowRegion1991"><rect
+ id="rect1993"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1995"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">Echo</flowPara><flowPara
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1997">Reference</flowPara><flowPara
+ style="font-size:8;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1999">binding.echo</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 517.28571,425.66591 C 645.85714,424.23734 645.85714,424.23734 645.85714,424.23734"
+ id="path2003" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2005"
+ width="73.166656"
+ height="30.708084"
+ x="563.42657"
+ y="202.31184"
+ rx="36.583328"
+ ry="0" />
+ <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2007"
+ width="73.166656"
+ height="30.708084"
+ x="563.40656"
+ y="246.5976"
+ rx="36.583328"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2009"
+ transform="translate(285.8806,-8.394223)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2011"><rect
+ id="rect2013"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2021">messagePrefix</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2023"
+ transform="translate(285.1663,39.46291)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2025"><rect
+ id="rect2027"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2035">complexProperty</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 447.85714,241.95163 C 563.57143,215.52305 563.57143,215.52305 563.57143,215.52305"
+ id="path2055" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2061"
+ transform="translate(33.15817,261.6669)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2063"><rect
+ id="rect2065"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2067">@DataBinding(&quot;org.w3c.dom.Node&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2069">&amp;</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2071">@DataBinding(&quot;javax.xml.stream.XMLStreamReader&quot;)</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2073"
+ transform="translate(258.3449,71.60582)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2075"><rect
+ id="rect2077"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2079">@DataBinding(&quot;java.lang.String&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2083" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 523.57143,293.3802 C 541.42857,289.09448 540.71429,289.09448 540.71429,289.09448"
+ id="path2087" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 322.14286,471.95163 C 375,436.95163 375,436.95163 375,436.95163"
+ id="path2976" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2978"
+ transform="translate(275.4877,156.6059)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2980"><rect
+ id="rect2982"
+ width="286.42859"
+ height="42.85714"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2988">&lt;db:databinding name=&quot;org.apache.axiom.om.OMElement&quot; /&gt;</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 677.85714,397.66591 C 684.28571,376.95163 684.28571,376.95163 684.28571,376.95163"
+ id="path2997" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3886"
+ transform="translate(96.76088,84.52404)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ inkscape:transform-center-y="72.857143"
+ inkscape:transform-center-x="90.714286"><flowRegion
+ id="flowRegion3888"><rect
+ id="rect3890"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara3892">Interface1</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 445.71429,250.52305 C 563.57143,262.66591 563.57143,262.66591 563.57143,262.66591"
+ id="path1956" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1958"
+ transform="translate(205.618,209.9526)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1960"><rect
+ id="rect1962"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1965">Echo</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1967"
+ transform="translate(259.7734,259.463)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1969"><rect
+ id="rect1971"
+ width="286.42859"
+ height="42.85714"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara1973">@DataBinding(&quot;org.w3c.dom.Node&quot;)</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 540.71429,471.23734 C 510,433.3802 511.42857,434.80877 511.42857,434.80877"
+ id="path1975" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2867"
+ transform="translate(-47.64121,63.74863)"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion2869"><rect
+ id="rect2871"
+ width="217.85715"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2873">@DataBinding(&quot;java.lang.String&quot;)</flowPara><flowPara
+ style="font-size:8px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"
+ id="flowPara2875" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0"
+ d="M 337.14286,286.23734 C 372.85714,294.80877 372.85714,294.80877 372.85714,294.80877"
+ id="path2877" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/pom.xml
new file mode 100644
index 0000000000..c8ae344f2c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>sample-databinding-echo</artifactId>
+ <name>Apache Tuscany Echo Data Binding Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-binding-echo</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java
new file mode 100644
index 0000000000..a0b39ad460
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.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 dbecho;
+
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("unused")
+public class ComponentAImpl implements Interface1 {
+
+ private Interface1 componentBReference;
+
+ @SuppressWarnings("unused")
+ private String prefix;
+
+ private String prefix1;
+
+ private String bar;
+
+ @Constructor
+ public ComponentAImpl(@Reference(name = "componentBReference", required = true)
+ Interface1 componentBReference) {
+ this.componentBReference = componentBReference;
+ }
+
+ public String call(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ public String call1(String msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentA --> Received message: " + request);
+ Object ret = componentBReference.call1(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentA --> Returned message: " + response);
+ return (String) ret;
+ }
+
+ @Property(name="prefix")
+ public void setPrefix(String prefix) {
+ System.out.println("[Property] prefix: " + prefix);
+ this.prefix = prefix;
+ }
+
+ @Property(name="prefix1")
+ public void setPrefix1(String prefix1) {
+ System.out.println("[Property] prefix1: " + prefix1);
+ this.prefix1 = prefix1;
+ }
+
+ /**
+ * @param bar the bar to set
+ */
+ @Property(name="bar")
+ public void setBar(String bar) {
+ System.out.println("[Property] bar: " + bar);
+ this.bar = bar;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java
new file mode 100644
index 0000000000..ff8968837d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.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 dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.Constructor;
+import org.osoa.sca.annotations.Reference;
+import org.w3c.dom.Node;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@AllowsPassByReference
+public class ComponentBImpl implements Interface2 {
+
+ private Echo echoReference;
+
+ @Constructor
+ public ComponentBImpl(@Reference(name = "echoReference", required = true)
+ Echo echoReference) {
+ this.echoReference = echoReference;
+ }
+
+ public Node call(Node msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentB --> Received message: " + request);
+ Node ret = (Node) echoReference.echo(msg);
+ String response = ret + " [" + ret.getClass().getName() + "]";
+ System.out.println("ComponentB --> Returned message: " + response);
+ return ret;
+ }
+
+ public XMLStreamReader call1(XMLStreamReader msg) {
+ String request = msg + " [" + msg.getClass().getName() + "]";
+ System.out.println("ComponentB --> Received message: " + request);
+// XMLStreamReader ret = (XMLStreamReader) echoReference.echo(msg);
+ String response = request;
+ System.out.println("ComponentB --> Returned message: " + response);
+ return msg;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Echo.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Echo.java
new file mode 100644
index 0000000000..25ecc90454
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Echo.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 dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Echo {
+ Object echo(Object msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java
new file mode 100644
index 0000000000..9ec3819899
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.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 dbecho;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ * @version $Rev$ $Date$
+ */
+public class EchoDataBindingClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("EchoDataBinding.composite");
+
+ Interface1 componentA = scaDomain.getService(Interface1.class, "ComponentA");
+ String response = componentA.call("<message><foo>123</foo></message>");
+ String response1= componentA.call1("<message><foo>123</foo></message>");
+
+
+ System.out.println("call response = " + response );
+ System.out.println("call1 response = " + response1 );
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface1.java
new file mode 100644
index 0000000000..70b450e358
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface1.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 dbecho;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("java.lang.String")
+@Remotable
+public interface Interface1 {
+ String call(String msg);
+ String call1(String msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface2.java
new file mode 100644
index 0000000000..b62f1f425d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/java/dbecho/Interface2.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 dbecho;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.databinding.annotation.DataBinding;
+import org.osoa.sca.annotations.Remotable;
+import org.w3c.dom.Node;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@DataBinding("org.w3c.dom.Node")
+@Remotable
+public interface Interface2 {
+ Node call(Node msg);
+ @DataBinding("javax.xml.stream.XMLStreamReader")
+ XMLStreamReader call1(XMLStreamReader msg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
new file mode 100644
index 0000000000..931d5c756c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/EchoDataBinding.composite
@@ -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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:local="http://tuscany.apache.org/xmlns/sca/binding/1.0" xmlns:f="http://foo"
+ xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance" name="EchoDataBinding">
+
+ <component name="ComponentA">
+ <implementation.java class="dbecho.ComponentAImpl" />
+ <reference name="componentBReference" target="ComponentB" />
+ <property name="prefix">ABC</property>
+ <property name="prefix1" source="$messagePrefix"></property>
+ <property name="bar" source="$complexProperty/*[local-name()='foo']/*[local-name()='bar']"></property>
+ </component>
+
+ <component name="ComponentB">
+ <implementation.java class="dbecho.ComponentBImpl" />
+ </component>
+
+ <reference name="EchoReference" promote="ComponentB/echoReference">
+ <!--
+ <interface.java interface="dbecho.Echo"/>
+ -->
+ <interface.wsdl interface="http://example.com/echo.wsdl#wsdl.interface(EchoPortType)"
+ wsdli:wsdlLocation="http://example.com/echo.wsdl wsdl/echo.wsdl">
+ <db:databinding xmlns:db="http://tuscany.apache.org/xmlns/sca/databinding/1.0" name="org.apache.axiom.om.OMElement" />
+ </interface.wsdl>
+ <binding.echo/>
+ </reference>
+
+ <property name="messagePrefix" type="xsd:string">ABC</property>
+ <property name="complexProperty" type="f:FooType">
+ <foo>
+ <bar attr="barAttr">BAR</bar>
+ </foo>
+ </property>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..13d0d6f570
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+echo.module.EchoModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl
new file mode 100644
index 0000000000..ef2308aa73
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl
@@ -0,0 +1,63 @@
+<?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="StockQuote" targetNamespace="http://example.com/echo.wsdl" xmlns:tns="http://example.com/echo.wsdl"
+ xmlns:xsd1="http://example.com/echo.xsd" xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <schema targetNamespace="http://example.com/echo.xsd" xmlns:tns="http://example.com/echo.xsd"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+ <complexType name="messageType">
+ <sequence>
+ <element name="foo" type="string"></element>
+ </sequence>
+ </complexType>
+ <element name="echo">
+ <complexType>
+ <sequence>
+ <element name="message" type="tns:messageType" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="echoResponse">
+ <complexType>
+ <sequence>
+ <element name="message" type="tns:messageType" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </types>
+
+ <message name="EchoInput">
+ <part name="body" element="xsd1:echo" />
+ </message>
+
+ <message name="EchoOutput">
+ <part name="body" element="xsd1:echoResponse" />
+ </message>
+
+ <portType name="EchoPortType">
+ <operation name="echo">
+ <input message="tns:EchoInput" />
+ <output message="tns:EchoOutput" />
+ </operation>
+ </portType>
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java
new file mode 100644
index 0000000000..43434d8cee
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.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 dbecho;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EchoDataBindingTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("EchoDataBinding.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ protected Interface1 componentA;
+
+ public void testTransform() {
+ componentA = scaDomain.getService(Interface1.class, "ComponentA");
+ componentA.call("<message><foo>123</foo></message>");
+ componentA.call1("<message><foo>123</foo></message>");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/README b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/README
new file mode 100644
index 0000000000..f57eb26920
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/README
@@ -0,0 +1,86 @@
+Hello World JSONRPC Sample
+==========================
+This sample demostrates the JSONRPC binding using a simple web app that
+talks JSONRPC to an SCA service.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+As this sample provides a web app there is a manual step where the WAR file
+that contains the sample is copied to your web app container. If you just want
+to give this sample a go deploy the WAR file (target/sample-helloworldjsonrpc.war)
+to you web application server.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworldjsonrpc
+
+The port and hostname will of course vary depending on your local installation.
+
+Sample Overview
+---------------
+The sample provides a single service which with an operation that reflects
+a greeting back to the called. The service is exposed using the JSONRPC
+binding. The web app provided shows how the service can be called either via
+via the SCA provided JSON client or by using the DOJO toolkit.
+
+helloworl-jsonrpc/
+ src/
+ main/
+ java/
+ helloworldjsonrpc/
+ HelloWorldService.java - service interface
+ HelloWorlsServiceImple.java - service implementation
+ resources/
+ jsonrpc.composite - the SCA assembly for this sample
+ webapp
+ WEB-INF/
+ web.xml - defines the listener that starts up the
+ Tuscany SCA runtime
+ HelloWorldJSONRPC.html - the web application that calls the
+ SCA service via JSONRPC
+
+ helloworld-jsonrpc.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file that unpacks the
+ dojo installation
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built using Ant as
+follows
+
+cd helloworld-jsonrpc
+ant package
+
+This should result in a war file (sample-helloworldjsonrpc.war) in the target
+directory. Copy this war file to your web app deployment directory in you
+web app container.
+
+The process for getting the web app running will depend on which web app container
+you are using. For example, if you are using Tomcat then it is simply a matter
+of copying the WAR file to the webapps directory.
+
+Once the web app is deployed use your browser to visit the following URL;
+
+http://localhost:8080/sample-helloworldjsonrpc
+
+The port and hostname will of course vary depending on your local installation.
+
+You should see a web page that allows you to send messages, via JSONRPC, to the
+application running in the Tuscany SCA Runtime
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd helloworld-jsonrpc
+mvn
+
+Again this should result in a war file (sample-calculator-web.war) in the target
+directory. Follow the steps described in the previous section for running the web
+app and for the expected results.
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build-dojo.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build-dojo.xml
new file mode 100644
index 0000000000..335a10817a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build-dojo.xml
@@ -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 name="DojoZipInstaller">
+
+
+ <property name="dojo.version" value="0.4.0"/>
+ <property name="dojo.distro" value="ajax"/>
+ <property name="unpack.location" value="${basedir}/src/main/webapp/dojo"/>
+
+
+ <target name="check-dojo-installed">
+ <condition property="already.installed" >
+ <available file="${localRepository}/dojo/dojo-${dojo.distro}/${dojo.version}/dojo-${dojo.distro}-${dojo.version}.zip"/>
+ </condition>
+ <condition property="maven.suffix" value="">
+ <os family="unix"/>
+ </condition>
+ <condition property="maven.suffix" value=".bat">
+ <os family="windows"/>
+ </condition>
+ </target>
+
+
+ <target name="check-dojo-unpacked">
+ <condition property="already.unpacked" >
+ <available file="${unpack.location}"/>
+ </condition>
+ </target>
+
+ <target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-${dojo.version}-${dojo.distro}.zip"
+ dest="${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
+ <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo-${dojo.distro} -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"/>
+ </exec>
+ </target>
+
+ <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
+ <mkdir dir="${basedir}/target/dojo-download/"/>
+ <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-${dojo.version}-${dojo.distro}.zip"
+ dest="${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"
+ verbose="true"
+ usetimestamp="true"/>
+ <copy file="${basedir}/target/dojo-download/dojo-${dojo.version}-${dojo.distro}.zip"
+ tofile="${localRepository}/dojo/dojo-${dojo.distro}/${dojo.version}/dojo-${dojo.distro}-${dojo.version}.zip"/>
+ </target>
+
+
+ <target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
+ <fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
+ <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
+ <unzip src="${localRepository}/dojo/dojo-${dojo.distro}/${dojo.version}/dojo-${dojo.distro}-${dojo.version}.zip"
+ dest="${basedir}/target/dojo-unpack-temp/"
+ overwrite="false">
+ <patternset>
+ <include name="dojo-${dojo.version}-${dojo.distro}/**"/>
+ <exclude name="dojo-${dojo.version}-${dojo.distro}/demos/**"/>
+ <exclude name="dojo-${dojo.version}-${dojo.distro}/tests/**"/>
+ </patternset>
+ </unzip>
+ <move file="${basedir}/target/dojo-unpack-temp/dojo-${dojo.version}-${dojo.distro}"
+ tofile="${unpack.location}"
+ verbose="true"/>
+ <delete dir="${basedir}/target/dojo-unpack-temp/"/>
+ </target>
+
+
+ <target name="clean-dojo-files">
+ <delete dir="${unpack.location}"/>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build.xml
new file mode 100644
index 0000000000..e188a47e7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/build.xml
@@ -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.
+-->
+<project name="helloworld-jsonrpc" default="package">
+ <property name="settings.localRepository" value="./target/repo" />
+ <property name="artifactId" value="sample-helloworld-jsonrpc" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ </target>
+
+ <target name="package" depends="compile">
+ <ant antfile="./build-dojo.xml" target="install-dojo-nomaven">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+
+ <war destfile="target/sample-helloworldjsonrpc.war"
+ webxml="src/main/webapp/WEB-INF/web.xml">
+ <fileset dir="src/main/webapp"/>
+ <zipfileset dir="../../modules" prefix="WEB-INF/lib">
+ <include name="sca-api-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-assembly-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-assembly-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-binding-jsonrpc-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-contribution-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-contribution-impl-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-databinding-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-core-spi-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-databinding-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-embedded-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-http-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-host-webapp-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-implementation-java-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-java-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-runtime-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-interface-wsdl-xml-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="tuscany-policy-0.90-incubating-SNAPSHOT.jar"/>
+ </zipfileset>
+ <lib dir="../../lib">
+ <include name="commonj-api-0.90-incubating-SNAPSHOT.jar"/>
+ <include name="json-rpc-1.0.jar"/>
+ <include name="stax-api-1.0.1.jar"/>
+ <include name="wsdl4j-1.6.2.jar"/>
+ <include name="wstx-asl-3.2.0.jar"/>
+ <include name="XmlSchema-1.3.1.jar"/>
+ <include name="**/../../modules/*.jar"/>
+ </lib>
+ <classes dir="target/classes"/>
+ </war>
+
+ <ant antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </target>
+
+
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.png b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.png
new file mode 100644
index 0000000000..57f90aed01
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg
new file mode 100644
index 0000000000..fe966d8c17
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/helloworld-jsonrpc.svg
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc"
+ sodipodi:docname="helloworld-jsonrpc.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-jsonrpc\helloworld-jsonrpc.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="516.28571"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="158"
+ inkscape:window-y="164" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="translate(144.2857,52.85714)">
+ <rect
+ rx="8.0946665"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31134"
+ height="299.99988"
+ width="262.14267"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999893;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldjsonrpc</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="449.91632"
+ y="349.31049"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(190.3256,143.3719)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">JSONService</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000036px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 373.48019,364.72909 L 455.16689,364.72909 L 470.019,392.34681 L 452.69154,417.84009 L 373.48019,417.84009 L 392.04536,392.34681 L 373.48019,364.72909 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1887"
+ transform="translate(113.6483,167.4037)"><flowRegion
+ id="flowRegion1889"><rect
+ id="rect1891"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1893">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1888"
+ width="85"
+ height="97.85714"
+ x="214.28571"
+ y="340.52307"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1892"
+ transform="translate(-56.88742,135.3526)"><flowRegion
+ id="flowRegion1894"><rect
+ id="rect1896"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1900">WebApp</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#f19a9a;fill-opacity:1;stroke:#2e2424;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:3, 1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1912"
+ width="45.714287"
+ height="40.714287"
+ x="277.85715"
+ y="370.52304"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1914"
+ transform="translate(1.400116,166.6895)"><flowRegion
+ id="flowRegion1916"><rect
+ id="rect1918"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1920">DOJO</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 324.28571,391.23734 C 391.42857,391.95163 391.42857,391.95163 391.42857,391.95163"
+ id="path1922" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/pom.xml
new file mode 100644
index 0000000000..0a71c4c946
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/pom.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-jsonrpc</artifactId>
+ <packaging>war</packaging>
+ <name>Apache Tuscany JSON-RPC Sample WebApp</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>sample-helloworldjsonrpc</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>install-dojo</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="install-dojo">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-dojo-files</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clean-dojo-files</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant antfile="./build-dojo.xml" target="clean-dojo-files">
+ <property name="localRepository" value="${settings.localRepository}"/>
+ <property name="artifactId" value="${artifactId}"/>
+ </ant>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldService.java
new file mode 100644
index 0000000000..3d8ea24f04
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/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 helloworldjsonrpc;
+
+/**
+ * This is the business interface of the HelloWorld service component.
+ */
+public interface HelloWorldService {
+
+ String getGreetings(String name);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java
new file mode 100644
index 0000000000..35fd00fabd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.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 helloworldjsonrpc;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service component.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldServiceImpl implements HelloWorldService {
+
+ /*
+ * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings()
+ */
+ public String getGreetings(String name) {
+ return "jsonrpcHello " + name;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.composite
new file mode 100644
index 0000000000..6ceef2041f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/resources/jsonrpc.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.
+-->
+
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="helloworldjsonrpc">
+
+ <service name="HelloWorldService" promote="HelloWorldJSONServiceComponent/HelloWorldService">
+ <interface.java interface="helloworldjsonrpc.HelloWorldService"/>
+ <binding.jsonrpc/>
+ </service>
+
+ <component name="HelloWorldJSONServiceComponent">
+ <implementation.java class="helloworldjsonrpc.HelloWorldServiceImpl"/>
+ </component>
+
+</composite>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html
new file mode 100644
index 0000000000..a684143794
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/HelloWorldJSONRPC.html
@@ -0,0 +1,134 @@
+<html>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+ <head>
+ <title>Tuscany JSON-RPC HelloWorld Example</TITLE>
+
+ <script type="text/javascript">
+ var djConfig = {isDebug: true,debugContainerId: "dojoDebug" };
+ //djConfig.debugAtAllCosts = true;
+ </script>
+
+ <script type="text/javascript" src="services/SCA/scripts"></script>
+
+ <script language="JavaScript">
+ SCA = new JSONRpcClient("services/HelloWorldService");
+
+ function getGreeting() {
+ var name = document.getElementById("name").value;
+ var result = SCA.HelloWorldService.getGreetings(name);
+ document.getElementById('greeting').innerHTML=result;
+ }
+ </script>
+
+ <script type="text/javascript" src="dojo/dojo.js">
+ </script>
+
+ <script type="text/javascript">
+ dojo.require("dojo.widget.*");
+ dojo.require("dojo.widget.Button");
+ dojo.require("dojo.rpc.JsonService");
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ </head>
+
+ <body>
+
+ <h2>Tuscany JSON-RPC HelloWorld Examples</h2>
+
+ <table>
+ <tr>
+ <th colspan="2">Non-Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ This example uses the JavaScript served from
+ <a href="services/SCA/scripts">services/SCA/scripts</a>
+ to make JSON-RPC requests to the service located at services/HelloWorldService.
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ Name please: &nbsp;&nbsp;&nbsp;
+ <input type="text" id="name" size="30" value="World" />
+ <input type="button" value="Submit" onclick="getGreeting()" />
+ </p>
+
+ </td>
+ <td>
+ <div id='greeting'>None Yet.</div>
+ </td>
+ </tr>
+ </table>
+
+ <br/>
+
+ <table>
+ <tr>
+ <th colspan="2">Dojo Example</th>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <p>This example uses the <a href="http://dojotoolkit.org/">Dojo Toolkit</a>
+ to create a JavaScript object <code>helloWorldService</code> for the service at services/HelloWorldService
+ using <a href="http://manual.dojotoolkit.org/WikiHome/DojoDotBook/Book9">Dojo's RPC classes</a>
+ and providing them with <a href="services/HelloWorldService?smd">services/HelloWorldService?smd</a>
+ for <a href="http://dojo.jot.com/SMD">Simple Method Description (SMD)</a> input.</p>
+ <p>It then creates a Dojo button that will envoke the <code>getGreetings</code> method of the <code>helloWorldService</code> object.</p>
+ </tr>
+ <tr>
+ <td>Request</td>
+ <td>Response</td>
+ </tr>
+ <tr>
+ <td>
+ <br><div id="myecho" dojoType="Button" onClick='helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);'>helloWorldService.getGreetings("Dojo").addCallback(contentCallBack);</div><br>
+ </td>
+ <td>
+ <div id="ReturnedContent">None Yet.</div>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <div id="dojoDebug">Dojo Debug:</div>
+ </td>
+ </tr>
+ </table>
+
+
+
+
+ <script type="text/javascript">
+
+ function contentCallBack(result) {
+ var handlerNode = document.getElementById("ReturnedContent");
+ handlerNode.innerHTML = "<p>" + result + "</p>" ;
+ }
+
+ var helloWorldService = new dojo.rpc.JsonService("services/HelloWorldService?smd");
+
+ </script>
+
+ </body>
+</html>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..be750ec461
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/META-INF/sca-contribution.xml
@@ -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.
+-->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:helloworldjsonrpc"/>
+</contribution>
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..2c0c79726d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?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.
+-->
+
+<!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>Tuscany sample HelloWorld JSON-RPC</display-name>
+
+ <welcome-file-list id="WelcomeFileList">
+ <welcome-file>HelloWorldJSONRPC.html</welcome-file>
+ </welcome-file-list>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.webapp.TuscanyContextListener</listener-class>
+ </listener>
+
+
+<servlet>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <servlet-class>org.apache.tuscany.sca.webapp.TuscanyServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>TuscanyServlet</servlet-name>
+ <url-pattern>/services/*</url-pattern>
+ </servlet-mapping>
+</web-app>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/style.css b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/style.css
new file mode 100644
index 0000000000..7073905b11
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-jsonrpc/src/main/webapp/style.css
@@ -0,0 +1,4 @@
+* { font-family: arial; }
+
+table, th, td { border: 2px solid blue; border-collapse: collapse; }
+th { color: white; background-color: blue; }
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/README b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/README
new file mode 100644
index 0000000000..a7a6ef2e30
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/README
@@ -0,0 +1,147 @@
+Hello World Web Service References Sample
+=========================================
+This sample demonstrates an SCA reference that uses a web service binding.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens you need to run the server first
+so open a command prompt, navigate to the helloworld-ws-service sample directory
+and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+
+Once the server is running open a command prompt, navigate to this sample
+directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient
+
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a reference with a
+web service binding. The binding refers to WSDL that identifies the service
+exposed by the helloworld-ws-service test.
+
+helloworld-ws-reference/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldServiceComponent.java - component implementation
+ HelloWorldClient.java - starts the SCA Runtime and
+ deploys the helloworldwsclient
+ .composite. It then calls the
+ HelloWorldServiceComponent
+ resources/
+ wsdl
+ helloworld.wsdl - the service description that the
+ SCA reference uses to bind to
+ helloworldwsclient.composite - the SCA assembly for this sample
+ helloworld-ws-reference.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant. Before
+you do this start up the service that the reference will talk to. To do this
+run up the helloworld-ws-service test. Take a look at the README in that sample
+and you will see you need the following commands
+
+cd helloworld-ws-service
+ant
+
+Once done you can now compile and run this sample using the following commands;
+
+cd helloworld-ws-reference
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] Injected hellowWorldService
+ [java] Called getGreetings
+ [java] Hello World
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-service sample first as Maven does this for you.
+
+cd helloworld-ws-reference
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldClientTestCase
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+10-May-2007 13:40:34 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+10-May-2007 13:40:35 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/xml.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client
+_1_1.xsd
+10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8080
+10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8080
+Injected hellowWorldService
+Called getGreetings
+10-May-2007 13:40:36 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8080
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.349 sec
+
+Results :
+
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/build.xml
new file mode 100644
index 0000000000..71ee66b31e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-reference" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldClient" />
+ <property name="test.jar" value="sample-helloworld-ws-reference.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.png b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.png
new file mode 100644
index 0000000000..bd2bba41db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.svg b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.svg
new file mode 100644
index 0000000000..354ffbae8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/helloworld-ws-reference.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference"
+ sodipodi:docname="helloworld-ws-reference.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="85"
+ inkscape:window-y="295" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldwsclient</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 528.16111,337.17632 L 561.49615,337.17632 L 567.55706,350.3083 L 560.486,362.43014 L 528.16111,362.43014 L 535.73726,350.3083 L 528.16111,337.17632 z "
+ id="path3019" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 651.01647,320.75333 L 718.80207,320.75333 L 731.12672,349.11387 L 716.74797,375.29287 L 651.01647,375.29287 L 666.4223,349.11387 L 651.01647,320.75333 z "
+ id="path1887" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1889"
+ transform="translate(388.9491,122.6895)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1891"><rect
+ id="rect1893"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1895">HelloWorld</flowPara><flowPara
+ id="flowPara1897">Service</flowPara><flowPara
+ id="flowPara1899" /></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 567.85714,349.09448 C 666.42857,348.3802 666.42857,348.3802 666.42857,348.3802"
+ id="path1901" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/pom.xml
new file mode 100644
index 0000000000..38354797da
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-reference</artifactId>
+ <name>Apache Tuscany HelloWorld Web Service Client Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-helloworld-ws-service</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java
new file mode 100644
index 0000000000..4559b282fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.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 helloworld;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+
+ public final static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ String value = helloWorldService.getGreetings("World");
+ System.out.println(value);
+
+ scaDomain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..433a98fd7f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.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 helloworld;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * The interface for the helloworld service
+ */
+@Remotable
+@Service
+public interface HelloWorldService {
+ public String getGreetings(String name);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java
new file mode 100644
index 0000000000..0dee19550b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.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;
+
+/**
+ * The HelloWorld service implementation
+ */
+public class HelloWorldServiceComponent implements HelloWorldService {
+
+ HelloWorldService helloWorldService;
+
+ public String getGreetings(String name) {
+ System.out.println("Called getGreetings");
+ return helloWorldService.getGreetings(name);
+ }
+
+ public HelloWorldService getHelloWorldService() {
+ System.out.println("Got Injected helloWorldService");
+ return helloWorldService;
+ }
+
+ public void setHelloWorldService(HelloWorldService helloWorldService) {
+ System.out.println("Injected helloWorldService");
+ this.helloWorldService = helloWorldService;
+ }
+} \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite
new file mode 100644
index 0000000000..1f1310cbe9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.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"
+ targetNamespace="http://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldwsclient">
+
+ <component name="HelloWorldServiceComponent">
+ <implementation.java class="helloworld.HelloWorldServiceComponent"/>
+ </component>
+
+ <reference name="HelloWorldService" promote="HelloWorldServiceComponent/helloWorldService">
+ <interface.java interface="helloworld.HelloWorldService" />
+ <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/logging.properties b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/logging.properties
new file mode 100644
index 0000000000..3dca310cdb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/logging.properties
@@ -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.
+#
+# $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..db4f6674aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<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/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java
new file mode 100644
index 0000000000..c4b7d03246
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.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 helloworld;
+
+import junit.framework.Assert;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test case for helloworld web service client
+ */
+public class HelloWorldClientTestCase {
+
+ private HelloWorldService helloWorldService;
+ private SCADomain scaDomain;
+
+ private SCATestCaseRunner server;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldwsclient.composite");
+ helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent");
+
+ server = new SCATestCaseRunner(HelloWorldServerTest.class);
+ server.before();
+
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testWSClient() throws Exception {
+ String msg = helloWorldService.getGreetings("Smith");
+ Assert.assertEquals("Hello Smith", msg);
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldServerTest.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldServerTest.java
new file mode 100644
index 0000000000..e19b3a0f8f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldServerTest.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.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Starts up the SCA runtime which starts listening for service requests
+ */
+public class HelloWorldServerTest {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8080);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/README b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/README
new file mode 100644
index 0000000000..f53c1d0afa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/README
@@ -0,0 +1,128 @@
+Hello World Web Service Service Sample
+======================================
+This sample demonstrates an SCA service that uses a web service binding.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer
+
+Now the server is started you can use the helloworld-ws-reference sample to
+exercise it.
+
+Sample Overview
+---------------
+The sample provides a single component that is wired to a service with a
+web service binding.
+
+helloworld-ws-service/
+ src/
+ main/
+ java/
+ helloworld/
+ HelloWorldService.java - interface description for
+ HelloWorldServiceComponent
+ HelloWorldImpl.java - component implementation
+ HelloWorldServer.java - starts the SCA Runtime and
+ deploys the helloworldws
+ .composite and then waits for the
+ service to be called via web services
+ resources/
+ wsdl/
+ helloworld.wsdl - the service description that describes
+ the exposed service
+ helloworldws.composite - the SCA assembly for this sample
+ helloworld-ws-service.png - a pictorial representation of the
+ sample .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant using the
+following commands
+
+cd helloworld-ws-service
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] log4j:WARN No appenders could be found for logger (org.apache.axiom.
+om.util.StAXUtils).
+ [java] log4j:WARN Please initialize the log4j system properly.
+ [java] HelloWorld server started (press enter to shutdown)
+
+As this point the SCA service is exposed as a web service by a web server
+started automatically by the SCA runtime. To stop the server just press
+enter.
+
+To exercise the service run up the helloworld-ws-reference sample. Take a look at
+the README in that sample and you will see you need the following commands
+
+cd helloworld-ws-reference
+ant run
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows. When using Maven you don't need to run the helloworld-
+ws-reference sample as Maven includes a simple ping test to make sure that the
+service is available
+
+cd helloworld-ws-service
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running helloworld.HelloWorldServerTestCase
+log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX
+Utils).
+log4j:WARN Please initialize the log4j system properly.
+10-May-2007 13:48:42 org.apache.catalina.core.StandardEngine start
+INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
+10-May-2007 13:48:42 org.apache.catalina.startup.ContextConfig defaultWebConfig
+INFO: No default web.xml
+10-May-2007 13:48:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd
+10-May-2007 13:48:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+1.dtd
+10-May-2007 13:48:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_
+2.dtd
+10-May-2007 13:48:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_
+0.xsd
+10-May-2007 13:48:42 org.apache.catalina.startup.DigesterFactory register
+WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs
+d
+10-May-2007 13:48:43 org.apache.coyote.http11.Http11Protocol init
+INFO: Initializing Coyote HTTP/1.1 on http-8080
+10-May-2007 13:48:43 org.apache.coyote.http11.Http11Protocol start
+INFO: Starting Coyote HTTP/1.1 on http-8080
+10-May-2007 13:48:43 org.apache.coyote.http11.Http11Protocol destroy
+INFO: Stopping Coyote HTTP/1.1 on http-8080
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.857 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/build.xml
new file mode 100644
index 0000000000..46678febc3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/build.xml
@@ -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.
+-->
+<project name="helloworld-ws-service" default="compile">
+ <property name="test.class" value="helloworld.HelloWorldServer" />
+ <property name="test.jar" value="sample-helloworld-ws-service.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.png b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.png
new file mode 100644
index 0000000000..6f7d9dd450
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.svg b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.svg
new file mode 100644
index 0000000000..3305faeed8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/helloworld-ws-service.svg
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service"
+ sodipodi:docname="helloworld-ws-service.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-reference\helloworld-ws-reference.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="519.38407"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="573"
+ inkscape:window-x="117"
+ inkscape:window-y="316" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(0.991389,0,0,1,2.215655,0)">
+ <rect
+ rx="13.79423"
+ ry="12.692303"
+ y="192.00233"
+ x="258.3114"
+ height="299.99988"
+ width="446.72086"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00866628;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">helloworldws</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="432.05917"
+ y="307.1676"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(172.4684,115.2291)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">HelloWorld</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 414.90867,339.0146 L 448.24371,339.0146 L 454.30462,352.14658 L 447.23356,364.26842 L 414.90867,364.26842 L 422.48482,352.14658 L 414.90867,339.0146 z "
+ id="path3017" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73064,320.75315 L 293.91185,320.75315 L 306.1266,352.82797 L 291.87606,382.43553 L 226.73064,382.43553 L 241.99911,352.82797 L 226.73064,320.75315 z "
+ id="path1892" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1894"
+ transform="translate(-37.47944,122.8324)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1896"><rect
+ id="rect1898"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1900">HelloWorld</flowPara><flowPara
+ id="flowPara1906">Web</flowPara><flowPara
+ id="flowPara1904">Service</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 305.71429,353.3802 L 422.85714,351.95163"
+ id="path1910"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\helloworld-ws-service\helloworld-ws-service.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/pom.xml
new file mode 100644
index 0000000000..c05016ae50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-helloworld-ws-service</artifactId>
+ <name>Apache Tuscany HelloWorld Web Service Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java
new file mode 100644
index 0000000000..0de3c70303
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/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/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java
new file mode 100644
index 0000000000..e03ed4dc25
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.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 helloworld;
+
+import java.io.IOException;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This server program shows how to create an SCA runtime, and start it which
+ * activates the helloworld Web service endpoint.
+ */
+public class HelloWorldServer {
+
+ public static void main(String[] args) {
+
+ SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite");
+
+ try {
+ System.out.println("HelloWorld server started (press enter to shutdown)");
+ System.in.read();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ scaDomain.close();
+ System.out.println("HelloWorld server stopped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java
new file mode 100644
index 0000000000..bd527ff8e2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.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.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+@Remotable
+@Service
+public interface HelloWorldService {
+
+ public String getGreetings(String name);
+}
+
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/helloworldws.composite b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/helloworldws.composite
new file mode 100644
index 0000000000..8add8f1e18
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/helloworldws.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://helloworld"
+ xmlns:hw="http://helloworld"
+ name="helloworldws">
+
+ <component name="HelloWorldServiceComponent">
+ <service name="HelloWorldService">
+ <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
+ <binding.ws />
+ </service>
+ <implementation.java class="helloworld.HelloWorldImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl
new file mode 100644
index 0000000000..db4f6674aa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl
@@ -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.
+-->
+<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/HelloWorldServiceComponent"/>
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java
new file mode 100644
index 0000000000..cc0c93bd50
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.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 helloworld;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HelloWorldServerTestCase {
+
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ scaDomain = SCADomain.newInstance("helloworldws.composite");
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8080);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/README b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/README
new file mode 100644
index 0000000000..7a840c1c8e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/README
@@ -0,0 +1,104 @@
+Calculator Sample
+=================
+
+This sample shows how composite can be used to implement components.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-composite.jar composite.CompositeClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-composite.jar composite.CompositeClient
+
+
+Sample Overview
+---------------
+
+The sample is comprised of three composites. Take a look at the composite file
+or the .svg/.png file which shows the composite file in pictorial form. The
+OuterComposite defines three components two of which are implemented using
+composites. The SourceComponent calls each TargetComponent in turn. There is a
+callback which returns from each TargetComponent to the SourceComponent.
+
+implementation-composite/
+ src/
+ main/
+ java/
+ composite/
+ Source.java - interface for the source component
+ SourceCallback.java - souce component callback interface
+ Target.java - interfact for the target component
+ etc.
+ CompositeClient.java - starts the SCA Runtime and
+ deploys the OuterComposite.composite.
+ This in turn pulls in the two inner
+ composites
+ resources/
+ OuterComposite.composite - the top level SCA assembly for this sample
+ InnerComposite.composite - included by OuterComposite.composite
+ InnerComposite2.composite - included by OuterComposite.composite
+ implementation-composite.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-composite
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Source: Client.main -> Source.clientMethod
+ [java] Source: Client.main => Source.clientMethod2
+ [java] Sleeping ...
+ [java] Target: Client.main -> Source.clientMethod
+ [java] Work thread Thread[pool-1-thread-1,5,main]
+ [java] Result: Client.main -> Source.clientMethod -> Target.someMethod
+ [java] Target: Client.main => Source.clientMethod2
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd implementation-composite
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running composite.CompositeTestCase
+Main thread Thread[main,5,main]
+Source: Client.main -> Source.clientMethod
+Source: Client.main => Source.clientMethod2
+Sleeping ...
+Target: Client.main -> Source.clientMethod
+Work thread Thread[pool-1-thread-1,5,main]
+Result: Client.main -> Source.clientMethod -> Target.someMethod
+Target: Client.main => Source.clientMethod2
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.374 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/build.xml
new file mode 100644
index 0000000000..7aa31aab8b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/build.xml
@@ -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.
+-->
+<project name="implementation-composite" default="compile">
+ <property name="test.class" value="composite.CompositeClient" />
+ <property name="test.jar" value="sample-implementation-composite.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.png b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.png
new file mode 100644
index 0000000000..4c6d71bc03
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.svg b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.svg
new file mode 100644
index 0000000000..0e60354aab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/implementation-composite.svg
@@ -0,0 +1,658 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\composite-impl"
+ sodipodi:docname="composite-impl.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\composite-impl\composite-impl.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="TriangleOutL"
+ style="overflow:visible">
+ <path
+ id="path3199"
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="TriangleInL"
+ style="overflow:visible">
+ <path
+ id="path3208"
+ d="M 5.77,0.0 L -2.88,5.0 L -2.88,-5.0 L 5.77,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lstart"
+ style="overflow:visible">
+ <path
+ id="path3279"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) translate(1,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path3276"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.98994949"
+ inkscape:cx="422.9821"
+ inkscape:cy="472.08096"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1163"
+ inkscape:window-height="727"
+ inkscape:window-x="49"
+ inkscape:window-y="142" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000072;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2067"
+ width="437.12573"
+ height="235.3502"
+ x="322.71631"
+ y="54.621651"
+ ry="9.9571238"
+ rx="13.497943" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2954"
+ transform="translate(52.97608,-147.3808)"><flowRegion
+ id="flowRegion2956"><rect
+ id="rect2958"
+ width="195.71428"
+ height="21.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2960">OuterComposite </flowPara></flowRoot> <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000024;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3038"
+ width="387.65787"
+ height="235.3502"
+ x="90.543831"
+ y="383.98276"
+ ry="9.9571238"
+ rx="11.970432" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3040"
+ transform="translate(-176.3391,188.4089)"><flowRegion
+ id="flowRegion3042"><rect
+ id="rect3044"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3046">InnerComposite</flowPara></flowRoot> <rect
+ style="fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3048"
+ width="324.99875"
+ height="235.3502"
+ x="555.21411"
+ y="379.94214"
+ ry="9.9571238"
+ rx="10.03559" />
+ <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3050"
+ width="501.42856"
+ height="300"
+ x="281.42856"
+ y="25.523054"
+ rx="2.4997854"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3052"
+ transform="translate(14.49567,-180.4534)"><flowRegion
+ id="flowRegion3054"><rect
+ id="rect3056"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3058">OuterComposite.composite</flowPara></flowRoot> <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.00000127, 1.0000002;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3060"
+ width="469.99997"
+ height="277.14301"
+ x="34.999977"
+ y="355.52322"
+ rx="2.3431036"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3062"
+ transform="translate(-231.9329,149.5466)"><flowRegion
+ id="flowRegion3064"><rect
+ id="rect3066"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3068">InnerComposite.composite</flowPara></flowRoot> <rect
+ style="opacity:1;fill:none;fill-opacity:1;stroke:#060000;stroke-width:1.00000024;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.00000217, 1.00000036;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3070"
+ width="370.06677"
+ height="277.14301"
+ x="526.42865"
+ y="355.52322"
+ rx="1.8449039"
+ ry="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3072"
+ transform="translate(259.4957,149.5466)"><flowRegion
+ id="flowRegion3074"><rect
+ id="rect3076"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3078">InnerComposite2.composite</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3080"
+ width="115.66247"
+ height="107.29153"
+ x="339.39774"
+ y="120.88454"
+ rx="6.9961648"
+ ry="8.9006968" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3082"
+ transform="translate(61.09274,-82.91111)"><flowRegion
+ id="flowRegion3084"><rect
+ id="rect3086"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3088">SourceComponent</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 419.07104,149.4647 L 471.74673,149.4647 L 481.32412,162.59667 L 470.1505,174.71851 L 419.07104,174.71851 L 431.04279,162.59667 L 419.07104,149.4647 z "
+ id="path3094" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 417.44485,192.18187 L 470.12055,192.18187 L 479.69794,205.31384 L 468.52432,217.43568 L 417.44485,217.43568 L 429.41661,205.31384 L 417.44485,192.18187 z "
+ id="path3096" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3098"
+ transform="matrix(0.588577,0,0,0.522806,267.0549,40.55827)"><flowRegion
+ id="flowRegion3100"><rect
+ id="rect3102"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3104">Target</flowPara><flowPara
+ id="flowPara3106">Component</flowPara><flowPara
+ id="flowPara3108">Ref</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3110"
+ transform="matrix(0.588577,0,0,0.522806,266.7932,82.35649)"><flowRegion
+ id="flowRegion3112"><rect
+ id="rect3114"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3116">Target</flowPara><flowPara
+ id="flowPara3118">Component</flowPara><flowPara
+ id="flowPara3120">Ref2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0"
+ d="M 386.42857,191.23734 L 272.85714,354.80877"
+ id="path3304" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3306"
+ width="122.73349"
+ height="85.862968"
+ x="521.41876"
+ y="82.620422"
+ rx="7.4238753"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3308"
+ transform="translate(243.9718,-121.6444)"><flowRegion
+ id="flowRegion3310"><rect
+ id="rect3312"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3314">TargetComponent</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 508.55406,120.18171 L 546.16282,120.18171 L 553.00077,133.31368 L 545.02316,145.43552 L 508.55406,145.43552 L 517.10151,133.31368 L 508.55406,120.18171 z "
+ id="path3318" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3322"
+ width="124.75388"
+ height="85.862968"
+ x="625.0321"
+ y="185.9852"
+ rx="7.5460844"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3324"
+ transform="translate(347.5847,-18.27962)"><flowRegion
+ id="flowRegion3326"><rect
+ id="rect3328"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3330">TargetComponent2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend);stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0"
+ d="M 675.79205,235.98775 L 764.68548,355.18575"
+ id="path3336" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 481.33769,161.74154 L 496.99505,161.74154 L 496.99505,134.46742 L 515.1778,134.46742"
+ id="path3362" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 67.175117,493.80686 L 112.47656,493.80686 L 120.71318,512.19162 L 111.1038,529.1622 L 67.175117,529.1622 L 77.470908,512.19162 L 67.175117,493.80686 z "
+ id="path3364" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3366"
+ transform="matrix(0.764739,0,0,0.753419,-137.1237,335.169)"><flowRegion
+ id="flowRegion3368"><rect
+ id="rect3370"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3372">Inner</flowPara><flowPara
+ id="flowPara3374">Source</flowPara><flowPara
+ id="flowPara3376">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:1.99999988;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3378"
+ width="115.66247"
+ height="123.2386"
+ x="222.2549"
+ y="461.59875"
+ rx="6.9961648"
+ ry="10.223635" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3380"
+ transform="translate(-41.0501,252.8032)"><flowRegion
+ id="flowRegion3382"><rect
+ id="rect3384"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3386">InnerSource</flowPara><flowPara
+ id="flowPara3398">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 207.36974,499.16011 L 246.68799,499.16011 L 253.83675,512.29208 L 245.49653,524.41392 L 207.36974,524.41392 L 216.30571,512.29208 L 207.36974,499.16011 z "
+ id="path3390" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 458.45503,498.7504 L 491.79007,498.7504 L 497.85098,511.88237 L 490.77992,524.00421 L 458.45503,524.00421 L 466.03118,511.88237 L 458.45503,498.7504 z "
+ id="path3394" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 457.8633,539.5488 L 491.19834,539.5488 L 497.25925,552.68077 L 490.18819,564.80261 L 457.8633,564.80261 L 465.43945,552.68077 L 457.8633,539.5488 z "
+ id="path3396" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 121.21831,512.76955 L 214.15234,512.76955"
+ id="path3402" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 313.13842,496.9668 L 365.81411,496.9668 L 375.3915,510.09877 L 364.21788,522.22061 L 313.13842,522.22061 L 325.11017,510.09877 L 313.13842,496.9668 z "
+ id="path3428" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 311.51223,539.68397 L 364.18793,539.68397 L 373.76532,552.81594 L 362.5917,564.93778 L 311.51223,564.93778 L 323.48399,552.81594 L 311.51223,539.68397 z "
+ id="path3430" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3432"
+ transform="matrix(0.588577,0,0,0.522806,161.1223,388.0604)"><flowRegion
+ id="flowRegion3434"><rect
+ id="rect3436"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3438">Target</flowPara><flowPara
+ id="flowPara3440">Component</flowPara><flowPara
+ id="flowPara3442">Ref</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3444"
+ transform="matrix(0.588577,0,0,0.522806,160.8606,429.8586)"><flowRegion
+ id="flowRegion3446"><rect
+ id="rect3448"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3450">Target</flowPara><flowPara
+ id="flowPara3452">Component</flowPara><flowPara
+ id="flowPara3454">Ref2</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 375,509.80877 L 465,510.52305"
+ id="path3456" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 374.28571,553.3802 L 465,553.3802"
+ id="path3458" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3460"
+ transform="matrix(0.768159,0,0,0.869201,176.2162,311.7866)"><flowRegion
+ id="flowRegion3462"><rect
+ id="rect3464"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3466">promote</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3468"
+ transform="matrix(0.768159,0,0,0.869201,176.8981,355.7265)"><flowRegion
+ id="flowRegion3470"><rect
+ id="rect3472"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3474">promote</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999988px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 538.20382,492.4365 L 583.50526,492.4365 L 591.74188,510.82126 L 582.1325,527.79184 L 538.20382,527.79184 L 548.49961,510.82126 L 538.20382,492.4365 z "
+ id="path3476" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3478"
+ transform="matrix(0.764739,0,0,0.753419,333.905,333.7986)"><flowRegion
+ id="flowRegion3480"><rect
+ id="rect3482"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3484">Inner</flowPara><flowPara
+ id="flowPara3486">Target</flowPara><flowPara
+ id="flowPara3488">Service</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.00000048;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3490"
+ width="124.75388"
+ height="85.862968"
+ x="698.64941"
+ y="459.73654"
+ rx="7.5460844"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3492"
+ transform="translate(445.4456,256.4819)"><flowRegion
+ id="flowRegion3494"><rect
+ id="rect3496"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3498">InnerTarget</flowPara><flowPara
+ id="flowPara3502">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 677.53028,495.80598 L 714.4917,495.80598 L 721.21196,510.79509 L 713.37166,524.63121 L 677.53028,524.63121 L 685.93061,510.79509 L 677.53028,495.80598 z "
+ id="path3500" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 916.90199,189.64981 L 1002.9382,189.64981 C 1002.9382,189.64981 1002.9382,235.81944 1002.9382,235.81944 C 989.62313,237.57221 976.30803,237.62595 962.99289,245.41312 C 953.65801,255.66964 935.10151,255.12922 917.92625,256.20602 L 916.90199,189.64981 z "
+ id="path3504"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3506"
+ transform="translate(646.5141,-15.23667)"><flowRegion
+ id="flowRegion3508"><rect
+ id="rect3510"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3514">TargetImpl</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3522"
+ transform="matrix(0.764739,0,0,0.753419,471.6381,345.0856)"><flowRegion
+ id="flowRegion3524"><rect
+ id="rect3526"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3532">Target</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 590.71429,511.23734 L 685,511.23734"
+ id="path3538" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 918.41044,67.959238 L 1004.4467,67.959238 C 1004.4467,67.959238 1004.4467,114.12887 1004.4467,114.12887 C 991.13163,115.88164 977.81652,115.93538 964.50132,123.72255 C 955.16646,133.97907 936.60996,133.43865 919.4347,134.51545 L 918.41044,67.959238 z "
+ id="path3576"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3578"
+ transform="translate(648.0226,-136.9272)"><flowRegion
+ id="flowRegion3580"><rect
+ id="rect3582"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3584">Target</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-mid:url(#TriangleInL);stroke-opacity:1"
+ d="M 961.42857,126.95163 L 961.42857,162.66591 L 961.42857,191.23734"
+ id="path3594" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 76.22763,193.09023 L 162.2639,193.09023 C 162.2639,193.09023 162.2639,239.25986 162.2639,239.25986 C 148.9488,241.01263 135.6337,241.06637 122.3185,248.85354 C 112.98365,259.11006 94.42715,258.56964 77.25189,259.64644 L 76.22763,193.09023 z "
+ id="path3600"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3602"
+ transform="translate(-194.1602,-11.79626)"><flowRegion
+ id="flowRegion3604"><rect
+ id="rect3606"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3608">SourceImpl</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 14.878937,64.256802 L 100.91526,64.256802 C 100.91526,64.256802 100.91526,110.42643 100.91526,110.42643 C 87.600157,112.1792 74.285057,112.23294 60.969857,120.02011 C 51.634957,130.27663 33.078457,129.73621 15.903197,130.81301 L 14.878937,64.256802 z "
+ id="path3610"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3612"
+ transform="translate(-255.5088,-140.6297)"><flowRegion
+ id="flowRegion3614"><rect
+ id="rect3616"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3618">Source</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1.00000024px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 140.55329,63.673523 L 239.44669,63.673523 C 239.44669,63.673523 239.44669,109.84315 239.44669,109.84315 C 224.14179,111.59592 208.83699,111.64966 193.53189,119.43683 C 182.80209,129.69335 161.47249,129.15293 141.73059,130.22973 L 140.55329,63.673523 z "
+ id="path3622"
+ sodipodi:nodetypes="cccccc" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3624"
+ transform="translate(-135.5491,-141.213)"><flowRegion
+ id="flowRegion3626"><rect
+ id="rect3628"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3630">SourceCallback</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:url(#TriangleOutL)"
+ d="M 108.08632,192.55119 L 77.781746,156.1857 L 51.51778,123.86082"
+ id="path3634" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-mid:url(#TriangleOutL)"
+ d="M 130.30968,192.55119 L 161.62441,159.21616 L 201.02036,117.7999"
+ id="path3636" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 800,511.23734 L 917.14286,238.3802"
+ id="path3640" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:3,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 610,125.52305 L 915.71429,216.95163"
+ id="path3646" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:6,1;stroke-dashoffset:0;marker-end:url(#Arrow2Lend)"
+ d="M 280,512.66591 L 132.85714,241.23734"
+ id="path3648" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3650"
+ transform="matrix(0.764739,0,0,0.753419,301.1926,-32.06018)"><flowRegion
+ id="flowRegion3652"><rect
+ id="rect3654"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3656">Target</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot3658"
+ transform="matrix(0.764739,0,0,0.753419,1.177328,346.747)"><flowRegion
+ id="flowRegion3660"><rect
+ id="rect3662"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3664">Source</flowPara></flowRoot> <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Lend)"
+ d="M 480.83261,205.68318 L 517.1981,205.68318 L 518.20826,511.7594 L 546.49253,511.7594"
+ id="path3670" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot3672"
+ transform="translate(281.8571,183.8295)"><flowRegion
+ id="flowRegion3674"><rect
+ id="rect3676"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara3678">InnerComposite2</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2048"
+ transform="matrix(0.768159,0,0,0.869201,-73.32453,313.1674)"><flowRegion
+ id="flowRegion2050"><rect
+ id="rect2052"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2054">promote</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot2056"
+ transform="matrix(0.768159,0,0,0.869201,397.4066,306.0963)"><flowRegion
+ id="flowRegion2058"><rect
+ id="rect2060"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2062">promote</flowPara></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/pom.xml
new file mode 100644
index 0000000000..1fcc707e46
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-composite</artifactId>
+ <name>Apache Tuscany Composite Implementation Sample</name>
+ <description>A sample showing local wiring of a component implemented by a nested composite</description>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/CompositeClient.java
new file mode 100644
index 0000000000..bf743e1797
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/CompositeClient.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 composite;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Simple client program that invokes the components that we wired together.
+ */
+public class CompositeClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance();
+
+ Source source = scaDomain.getService(Source.class, "SourceComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Source.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Source.java
new file mode 100644
index 0000000000..d0efcc1df1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Source.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 composite;
+
+public interface Source {
+
+ void clientMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceCallback.java
new file mode 100644
index 0000000000..baa95a8e39
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceCallback.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 composite;
+
+public interface SourceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceImpl.java
new file mode 100644
index 0000000000..b9a0c7ff74
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/SourceImpl.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 composite;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(Source.class)
+@Scope("COMPOSITE")
+public class SourceImpl implements Source, SourceCallback {
+
+ private Target targetReference;
+ private Target targetReference2;
+
+ @Reference
+ public void setTargetReference(Target target) {
+ this.targetReference = target;
+ }
+
+ @Reference
+ public void setTargetReference2(Target target) {
+ this.targetReference2 = target;
+ }
+
+ public void clientMethod(String arg) {
+ System.out.println("Source: " + arg + " -> Source.clientMethod");
+ targetReference.someMethod(arg + " -> Source.clientMethod");
+
+ System.out.println("Source: " + arg + " => Source.clientMethod2");
+ targetReference2.someMethod(arg + " => Source.clientMethod2");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Target.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Target.java
new file mode 100644
index 0000000000..9a8f68a7fa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/Target.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 composite;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+
+
+@Callback(SourceCallback.class)
+public interface Target {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/TargetImpl.java
new file mode 100644
index 0000000000..86686e9233
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/java/composite/TargetImpl.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 composite;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+
+@Service(Target.class)
+@Scope("COMPOSITE")
+public class TargetImpl implements Target {
+
+ private SourceCallback sourceCallback;
+
+ @Callback
+ public void setSourceCallback(SourceCallback sourceCallback) {
+ this.sourceCallback = sourceCallback;
+ }
+
+ public void someMethod(String arg) {
+ System.out.println("Target: " + arg);
+ sourceCallback.receiveResult(arg + " -> Target.someMethod");
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite.composite b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite.composite
new file mode 100644
index 0000000000..3376ac8ff5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite.composite
@@ -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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite">
+
+ <service name="InnerSourceService" promote="InnerSourceComponent">
+ <interface.java interface="composite.Source"/>
+ </service>
+
+ <component name="InnerSourceComponent">
+ <implementation.java class="composite.SourceImpl"/>
+ </component>
+
+ <reference name="targetComponentRef" promote="InnerSourceComponent/targetReference">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+ <reference name="targetComponentRef2" promote="InnerSourceComponent/targetReference2">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </reference>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite2.composite
new file mode 100644
index 0000000000..c9eff4fa9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/InnerComposite2.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://sample"
+ xmlns:sample="http://sample"
+ name="InnerComposite2">
+
+ <service name="InnerTargetService" promote="InnerTargetComponent">
+ <interface.java interface="composite.Target" callbackInterface="composite.SourceCallback"/>
+ </service>
+
+ <component name="InnerTargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..71859a321e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ -->
+
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:OuterComposite"/>
+</contribution> \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/OuterComposite.composite b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/OuterComposite.composite
new file mode 100644
index 0000000000..cb1c1e13d4
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/main/resources/OuterComposite.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"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ name="OuterComposite">
+
+ <component name="SourceComponent">
+ <implementation.composite name="sample:InnerComposite"/>
+ <reference name="targetComponentRef" target="TargetComponent"/>
+ <reference name="targetComponentRef2" target="TargetComponent2/InnerTargetService"/>
+ </component>
+
+ <component name="TargetComponent">
+ <implementation.java class="composite.TargetImpl"/>
+ </component>
+
+ <component name="TargetComponent2">
+ <implementation.composite name="sample:InnerComposite2"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java
new file mode 100644
index 0000000000..d20f6d17d3
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-composite/src/test/java/composite/CompositeTestCase.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 composite;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class CompositeTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Source source;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance();
+ source = scaDomain.getService(Source.class, "SourceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ System.out.println("Main thread " + Thread.currentThread());
+ source.clientMethod("Client.main");
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/README b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/README
new file mode 100644
index 0000000000..1c285564db
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/README
@@ -0,0 +1,113 @@
+Implementation CRUD Sample Client
+=================================
+This sample demonstrates how to use the new implementation extension,
+implementation-crud
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens, open a command prompt,
+navigate to this sample directory, and do
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;..\implementation-crud\target\sample-implementation-crud.jar;target\sample-implementation-crud-client.jar crud.client.CRUDClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:../implementation-crud/target/sample-implementation-crud.jar:target/sample-implementation-crud-client.jar crud.client.CRUDClient
+
+This looks like a long command. The three things we add to the classpath are
+
+tuscany-sca-manifest.jar - all of the standard Tuscany SCA
+ runtime and extension classes
+sample-implementation-crud.jar - the new crud implementation extension
+sample-implementation-crud-client.jar - the application that uses the crud
+ implementation
+
+Sample Overview
+---------------
+This sample contains a client application for a CRUD implementation type that
+shows how to create new implementation types. See the README for the
+mplementation-crud sample for details of this implementation type.
+
+implementation-crud-client/
+ src/
+ main/
+ java/
+ crud/
+ CRUDClient.java - sample client
+ resources/
+ crudclient.composite - the SCA assembly used by this sample
+
+ test/
+ java/
+ crud/
+ CRUDTestCase.java - sample JUnit test case for the sample client
+
+ implementation-crudclient.png- a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd implementation-crud-client
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Starting CRUDServiceComponent
+ [java] create(ABC) in tmp
+ [java] retrieve(0)
+ [java] Result from create: ABC
+ [java] update(0)
+ [java] retrieve(0)
+ [java] Result from update: EFG
+ [java] delete(0)
+ [java] retrieve(0)
+ [java] Result from delete: null
+ [java] Stopping CRUDServiceComponent
+
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and
+run using Maven as follows.
+
+cd implementation-crud-client
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crudClient.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+Result from create: ABC
+update(0)
+retrieve(0)
+Result from update: EFG
+delete(0)
+retrieve(0)
+Result from delete: null
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/build.xml
new file mode 100644
index 0000000000..b06c13ae85
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/build.xml
@@ -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.
+-->
+<project name="implementation-crud-client" default="compile">
+ <property name="test.class" value="crud.client.CRUDClient" />
+ <property name="test.jar" value="sample-implementation-crud-client.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../implementation-crud/target/sample-implementation-crud.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../implementation-crud/target/sample-implementation-crud.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement location="target/${test.jar}"/>
+ <pathelement location="../implementation-crud/target/sample-implementation-crud.jar"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.png b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.png
new file mode 100644
index 0000000000..a292037e7a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.svg b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.svg
new file mode 100644
index 0000000000..dbb37be208
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/implementation-crud.svg
@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud"
+ sodipodi:docname="implementation-crud.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\implementation-crud\implementation-crud.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="528.85714"
+ inkscape:cy="406.01174"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1142"
+ inkscape:window-height="722"
+ inkscape:window-x="107"
+ inkscape:window-y="128" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.038749,0,0,1.009461,-29.25616,-1.807024)">
+ <rect
+ rx="8.7034655"
+ ry="12.692303"
+ y="192.00233"
+ x="375.89822"
+ height="299.99988"
+ width="281.85843"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95312572;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(104.5213,-10.61387)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">crud</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="450.63062"
+ y="302.8819"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(183.0398,96.94336)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">CRUDService</flowPara><flowPara
+ id="flowPara1894">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 433.4801,334.72889 L 466.81514,334.72889 L 472.87605,347.86087 L 465.80499,359.98271 L 433.4801,359.98271 L 441.05625,347.86087 L 433.4801,334.72889 z "
+ id="path3017" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1904"
+ transform="translate(158.2681,129.761)"><flowRegion
+ id="flowRegion1906"><rect
+ id="rect1908"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1912"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans">CRUD</flowPara></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/pom.xml
new file mode 100644
index 0000000000..c671b265f0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud-client</artifactId>
+ <name>Apache Tuscany CRUD Implementation Extension Sample Client</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sample-implementation-crud</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.java
new file mode 100644
index 0000000000..ff2da8985b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/java/crud/client/CRUDClient.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 crud.client;
+
+import crud.CRUD;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CRUDClient {
+
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("crud.composite");
+ CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ System.out.println("Result from create: " + result);
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ System.out.println("Result from update: " + result);
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ if (result == null) {
+ System.out.println("Result from delete: null");
+ } else {
+ System.out.println("Result from delete: should be null but was " + result);
+ }
+
+ scaDomain.close();
+
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/resources/crud.composite b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/main/resources/crud.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"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.java
new file mode 100644
index 0000000000..c3fe9d0f62
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud-client/src/test/java/crud/client/CRUDTestCase.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 crud.client;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import crud.CRUD;
+
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+
+ @Override
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals(result, "ABC");
+
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals(result, "EFG");
+
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/README b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/README
new file mode 100644
index 0000000000..225829a46c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/README
@@ -0,0 +1,78 @@
+Implementation CRUD Sample
+==========================
+This sample demonstrates how new implementation types are constructed for
+Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the crud implementation type that this sample provides
+please see the implementation-crud-client sample that provides the necessary
+client code to bring up an application that uses this implementation-crud
+
+Sample Overview
+---------------
+This sample contains a CRUD implementation type as an example of how to create
+new implementation types. Components using this implementation type always
+expose the same Create, Retrieve, Update and Delete interface. This sample
+uses a singleton ResourceManager to perform the CRUD operations but of course
+a real component would provide a real implementation.
+
+implementation-crud/
+ src/
+ main/
+ java/
+ crud/ - implementation model interfaces
+ crud.backend/ - fake component implementation
+ crud.impl/ - implementations of the model interfaces
+ crud.module/ - gets the implementation-crud module registered
+ with the SCA runtime
+ crud.provider/ - runtime implementation
+ resources/
+ crud.composite - the SCA assembly used during unit testing
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-crud
+ant compile
+
+See the sample implementation-crud-client to run a sample that uses this
+binding.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-crud
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+update(0)
+retrieve(0)
+delete(0)
+retrieve(0)
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/build.xml
new file mode 100644
index 0000000000..79bd63aeea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/build.xml
@@ -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.
+-->
+<project name="implementation-crud" default="compile">
+ <property name="test.jar" value="sample-implementation-crud.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/pom.xml
new file mode 100644
index 0000000000..a9a47f18a1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud</artifactId>
+ <name>Apache Tuscany CRUD Implementation Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUD.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUD.java
new file mode 100644
index 0000000000..b23d85887b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUD.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 crud;
+
+/**
+ * The service interface of the single CRUD service provided by CRUD components.
+ */
+public interface CRUD {
+
+ /**
+ * Create a new resource.
+ * @param resource
+ * @return
+ */
+ String create(Object resource);
+
+ /**
+ * Retrieve a resource.
+ * @param id
+ * @return
+ */
+ Object retrieve(String id);
+
+ /**
+ * Update a resource.
+ * @param id
+ * @param resource
+ * @return
+ */
+ Object update(String id, Object resource);
+
+ /**
+ * Delete a resource.
+ * @param id
+ */
+ void delete(String id);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementation.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..5cb2bd2b1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementation.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 crud;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public interface CRUDImplementation extends Implementation {
+
+ /**
+ * Returns the directory used by CRUD implementations to persist resources.
+ *
+ * @return the directory used to persist resources
+ */
+ public String getDirectory();
+
+ /**
+ * Sets the directory used by CRUD implementations to persist resources.
+ *
+ * @param directory the directory used to persist resources
+ */
+ public void setDirectory(String directory);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementationFactory.java
new file mode 100644
index 0000000000..2a6f3bd955
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/CRUDImplementationFactory.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 crud;
+
+/**
+ * A factory for the sample CRUD implementation model.
+ */
+public interface CRUDImplementationFactory {
+
+ /**
+ * Creates a new CRUD implementation.
+ *
+ * @return
+ */
+ CRUDImplementation createCRUDImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/DefaultCRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/DefaultCRUDImplementationFactory.java
new file mode 100644
index 0000000000..38aac604d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/DefaultCRUDImplementationFactory.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 crud;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+
+import crud.impl.CRUDImplementationImpl;
+
+/**
+ * A default factory for the CRUD implementation model.
+ */
+public class DefaultCRUDImplementationFactory implements CRUDImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector introspector;
+
+ public DefaultCRUDImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ public CRUDImplementation createCRUDImplementation() {
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory, introspector);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/backend/ResourceManager.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/backend/ResourceManager.java
new file mode 100644
index 0000000000..2baf95c561
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/backend/ResourceManager.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 crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import crud.CRUD;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ */
+public class ResourceManager implements CRUD {
+ private static int counter;
+ private static final Map<String, Object> store = new HashMap<String, Object>();
+ private String directory;
+
+ /**
+ * Constructs a new resource manager.
+ *
+ * @param directory the directory where to persist resources
+ */
+ public ResourceManager(String directory) {
+ super();
+ this.directory = directory;
+ }
+
+ /**
+ * Creates a new resource.
+ *
+ * @param resource
+ * @return
+ */
+ public String createResource(Object resource) {
+ System.out.println("create(" + resource + ") in " + directory);
+ String key = String.valueOf(counter++);
+ store.put(key, resource);
+ return key;
+ }
+
+ /**
+ * Deletes a resource.
+ *
+ * @param id
+ */
+ public void deleteResource(String id) {
+ System.out.println("delete(" + id + ")");
+ store.remove(id);
+ }
+
+ /**
+ * Retrieves a resource.
+ *
+ * @param id
+ * @return
+ */
+ public Object retrieveResource(String id) {
+ System.out.println("retrieve(" + id + ")");
+ return store.get(id);
+ }
+
+ /**
+ * Updates a resource.
+ *
+ * @param id
+ * @param resource
+ * @return
+ */
+ public Object updateResource(String id, Object resource) {
+ System.out.println("update(" + id + ")");
+ return store.put(id, resource);
+ }
+
+ //FIXME We shouldn't have to implement the CRUD interface here
+
+ public String create(Object resource) {
+ return createResource(resource);
+ }
+
+ public Object retrieve(String id) {
+ return retrieveResource(id);
+ }
+
+ public Object update(String id, Object resource) {
+ return updateResource(id, resource);
+ }
+
+ public void delete(String id) {
+ deleteResource(id);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationImpl.java
new file mode 100644
index 0000000000..4dd3e336b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationImpl.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 crud.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import crud.CRUD;
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+public class CRUDImplementationImpl implements CRUDImplementation {
+
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+
+ // CRUD implementation always provide a single service exposing
+ // the CRUD interface, and have no references and properties
+ crudService = assemblyFactory.createService();
+ crudService.setName("CRUD");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = introspector.introspect(CRUD.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ crudService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample CRUD implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample CRUD implementation provides a single fixed CRUD service
+ return Collections.singletonList(crudService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample CRUD implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample CRUD implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample CRUD implementation does not have a URI
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample CRUD implementation does not support policy sets
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample CRUD implementation does not support intents
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample CRUD implementation does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // The sample CRUD implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample CRUD implementation is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationProcessor.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationProcessor.java
new file mode 100644
index 0000000000..cf57336cd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/impl/CRUDImplementationProcessor.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 crud.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_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.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 crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+/**
+ * Implements a STAX artifact processor for CRUD implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.crud>
+ * elements in SCA assembly XML composite files and populating the CRUD
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ */
+public class CRUDImplementationProcessor implements StAXArtifactProcessor<CRUDImplementation> {
+ private static final QName IMPLEMENTATION_CRUD = new QName("http://crud", "implementation.crud");
+
+ private CRUDImplementationFactory crudFactory;
+
+ public CRUDImplementationProcessor(CRUDImplementationFactory crudFactory) {
+ this.crudFactory = crudFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_CRUD;
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return CRUDImplementation.class;
+ }
+
+ public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPLEMENTATION_CRUD.equals(reader.getName());
+
+ // Read an <implementation.crud> element
+ try {
+ // Read the directory attribute. This is where the sample
+ // CRUD implementation will persist resources.
+ String directory = reader.getAttributeValue(null, "directory");
+
+ // Create an initialize the CRUD implementation model
+ CRUDImplementation implementation = crudFactory.createCRUDImplementation();
+ implementation.setDirectory(directory);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(CRUDImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(CRUDImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/module/CRUDModuleActivator.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/module/CRUDModuleActivator.java
new file mode 100644
index 0000000000..49b0eef259
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/module/CRUDModuleActivator.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 crud.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+import crud.CRUDImplementationFactory;
+import crud.DefaultCRUDImplementationFactory;
+import crud.impl.CRUDImplementationProcessor;
+import crud.provider.CRUDImplementationProviderFactory;
+
+/**
+ * Implements a module activator for the CRUD implementation extension module.
+ * The module activator is responsible for contributing the CRUD implementation
+ * extensions and plugging them in the extension points defined by the Tuscany
+ * runtime.
+ */
+public class CRUDModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // This module extension does not contribute any new extension point
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the CRUD implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory, introspector);
+
+ // Add the CRUD implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ CRUDImplementationProcessor implementationArtifactProcessor = new CRUDImplementationProcessor(crudFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the CRUD provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new CRUDImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProvider.java
new file mode 100644
index 0000000000..0f040a478f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProvider.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 crud.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import crud.CRUDImplementation;
+import crud.backend.ResourceManager;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public class CRUDImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private CRUDImplementation implementation;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
new file mode 100644
index 0000000000..08e041d7e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDImplementationProviderFactory.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 crud.provider;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ return new CRUDImplementationProvider(component, implementation);
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ return CRUDImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDInvoker.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDInvoker.java
new file mode 100644
index 0000000000..f09922e965
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/java/crud/provider/CRUDInvoker.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 crud.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+import crud.backend.ResourceManager;
+
+/**
+ * Implements a target invoker for CRUD component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ */
+public class CRUDInvoker implements Invoker {
+ private Operation operation;
+ private ResourceManager resourceManager;
+
+ public CRUDInvoker(Operation operation, ResourceManager resourceManager) {
+ this.operation = operation;
+ this.resourceManager = resourceManager;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ if (operation.getName().equals("create")) {
+ return resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ return resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ return resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ return null;
+
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..d9ab99f258
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# Implementation class for the ExtensionActivator
+crud.module.CRUDModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/java/crud/CRUDTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/java/crud/CRUDTestCase.java
new file mode 100644
index 0000000000..8b092818a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/java/crud/CRUDTestCase.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 crud;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the CRUD service
+ */
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CRUD crudService;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+
+ public void testCRUD() throws Exception {
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals("ABC", result);
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals("EFG", result);
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/resources/crud.composite b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/implementation-crud/src/test/resources/crud.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"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/pom.xml
new file mode 100644
index 0000000000..1e58d99e1b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-loanapplication</artifactId>
+ <name>Apache Tuscany Loan Application Conversation Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java
new file mode 100644
index 0000000000..441f68ebf0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplication.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 loanapplication;
+
+public class LoanApplication {
+
+ private String customerName;
+ private float loanAmount;
+
+ public LoanApplication(String customerName, float loanAmount) {
+ this.customerName = customerName;
+ this.loanAmount = loanAmount;
+ }
+
+ public String toString() {
+ return "[Customer: " + customerName + ", loan amount: "
+ + loanAmount + "]";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java
new file mode 100644
index 0000000000..5183ece867
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.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 loanapplication;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+
+public class LoanApplicationClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain domain = SCADomain.newInstance("loanapplication.composite");
+
+ // Locate the MyClient component and invoke it
+ LoanClient loanClient = domain.getService(LoanClient.class, "LoanClientComponent");
+ loanClient.applyForLoan("John Doe", 1000.0f);
+ System.out.println(loanClient.displayLoan());
+ System.out.println("Loan approved: " + loanClient.isApproved());
+
+ domain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClient.java
new file mode 100644
index 0000000000..7e4438bbff
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClient.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 loanapplication;
+
+public interface LoanClient {
+
+ void applyForLoan(String customerName, float amount);
+ boolean isApproved();
+ boolean isCancelled();
+ String displayLoan();
+ void cancelLoan();
+ void closeLoan();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java
new file mode 100644
index 0000000000..b06d9465a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.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 loanapplication;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("COMPOSITE")
+public class LoanClientImpl implements LoanClient {
+
+ private LoanService loanService;
+
+ @Reference
+ public void setLoanService(LoanService loanService) {
+ this.loanService = loanService;
+ }
+
+ public void applyForLoan(String customerName, float amount) {
+ loanService.apply(new LoanApplication(customerName, amount));
+ }
+
+ public boolean isApproved() {
+ if (loanService.getLoanStatus() == null) {
+ return false;
+ }
+ return loanService.getLoanStatus().equals("approved");
+ }
+
+ public boolean isCancelled() {
+ if (loanService.getLoanStatus() == null) {
+ return false;
+ }
+ return loanService.getLoanStatus().equals("cancelled");
+ }
+
+ public String displayLoan() {
+ return loanService.display();
+ }
+
+ public void cancelLoan() {
+ loanService.cancelApplication();
+ }
+
+ public void closeLoan() {
+ loanService.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanService.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanService.java
new file mode 100644
index 0000000000..d09864ea55
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanService.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 loanapplication;
+
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+@Remotable
+public interface LoanService {
+ void apply(LoanApplication application);
+ void lockCurrentRate(int termInYears);
+ @OneWay
+ void cancelApplication();
+ String getLoanStatus();
+ String display();
+ @EndsConversation
+ void close();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java
new file mode 100644
index 0000000000..76a53323bd
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.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 loanapplication;
+
+import org.osoa.sca.annotations.AllowsPassByReference;
+import org.osoa.sca.annotations.ConversationID;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("CONVERSATION")
+@AllowsPassByReference
+public class LoanServiceImpl implements LoanService {
+
+ private LoanApplication application;
+ private String status;
+ private int termLocked = 0;
+ @ConversationID
+ protected String conversationID;
+
+ public void apply(LoanApplication application) {
+ this.application = application;
+ status = "open";
+ }
+
+ public void lockCurrentRate(int termInYears) {
+ termLocked = termInYears;
+ status = "locked";
+ }
+
+ public void cancelApplication() {
+ status = "cancelled";
+ }
+
+ public String getLoanStatus() {
+ return status;
+ }
+
+ public String display() {
+ return "Loan application: " + application + ", term: "
+ + termLocked + ", status: " + status
+ + ", conversationID: " + conversationID;
+ }
+
+ public void close() {
+ this.application = null;
+ this.status = "closed";
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/resources/loanapplication.composite b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/resources/loanapplication.composite
new file mode 100644
index 0000000000..3aa8d030b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/main/resources/loanapplication.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"
+ targetNamespace="http://loanapplication"
+ xmlns:la="http://loanapplication"
+ name="loanapplication">
+
+ <component name="LoanClientComponent">
+ <implementation.java class="loanapplication.LoanClientImpl"/>
+ <reference name="loanService" target="LoanServiceComponent"/>
+ </component>
+
+ <component name="LoanServiceComponent">
+ <implementation.java class="loanapplication.LoanServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java
new file mode 100644
index 0000000000..f97dfc9875
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.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 loanapplication;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+public class LoanApplicationTestCase extends TestCase {
+
+ private LoanClient loanClient;
+ private SCADomain domain;
+
+ protected void setUp() throws Exception {
+ domain = SCADomain.newInstance("loanapplication.composite");
+
+ loanClient = domain.getService(LoanClient.class, "LoanClientComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ domain.close();
+ }
+
+ public void test() throws Exception {
+ try {
+ loanClient.applyForLoan("John Doe", 1000.0f);
+ System.out.println("Applied: " + loanClient.displayLoan());
+ System.out.println("Loan approved: " + loanClient.isApproved());
+ loanClient.cancelLoan();
+ System.out.println("Sleeping to let cancel complete ...");
+ Thread.sleep(500);
+ if (!loanClient.isCancelled()) {
+ fail("Loan should be cancelled");
+ }
+ System.out.println("Cancelled: " + loanClient.displayLoan());
+ loanClient.closeLoan();
+
+ /* This is a mistake, after @EndsConversation, a new conversation is
+ * started automatically, so we should not get TargetNotFoundException.
+ * Keep this for the timeout case, where we should get the exception
+ try {
+ System.out.println("Trying to use the closed loan in the ended conversation ...");
+ System.out.println("Closed: " + loanClient.displayLoan());
+ fail("Target should not be found");
+ } catch(TargetNotFoundException e) {
+ System.out.println("Target not found as expected");
+ }
+ */
+
+ // Now check that a new conversation's loan is not cancelled
+
+ if (loanClient.isCancelled()) {
+ fail("Loan should not be cancelled");
+ }
+ } catch(Throwable e) {
+ e.printStackTrace();
+ if (e instanceof Exception) {
+ throw (Exception)e;
+ }
+ if (e instanceof Error) {
+ throw (Error)e;
+ }
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/pom.xml
new file mode 100644
index 0000000000..353d99756b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/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.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>tuscany-samples</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Tuscany SCA Samples</name>
+
+ <profiles>
+ <profile>
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <modules>
+ <module>binding-echo</module>
+ <module>binding-echo-appl</module>
+ <module>calculator</module>
+ <module>calculator-rmi-reference</module>
+ <module>calculator-rmi-service</module>
+ <module>calculator-script</module>
+ <module>calculator-web</module>
+ <module>databinding-echo</module>
+ <module>helloworld-jsonrpc</module>
+ <module>helloworld-ws-service</module>
+ <module>helloworld-ws-reference</module>
+ <module>implementation-composite</module>
+ <module>implementation-crud</module>
+ <module>implementation-crud-client</module>
+ <!--
+ <module>loanapplication</module>
+ -->
+ <module>simple-bigbank</module>
+ <module>simple-callback</module>
+ <module>supplychain</module>
+ </modules>
+ </profile>
+
+ </profiles>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/README b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/README
new file mode 100644
index 0000000000..4110f081a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/README
@@ -0,0 +1,85 @@
+Calculator Sample
+=================
+This sample implements a simple a version of the BigBank scenrio used in
+various places in the SCA specification documents.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank.jar bigbank.client.BigBankClient
+
+
+Sample Overview
+---------------
+The sample provides a composite with two java components wired together
+with a default binding. A request to the AccountComponent results in a
+requrest to the AccountDataComponent to get account data. The data retuns
+back via the AccountComponent to the client.
+
+calculator/
+ src/
+ main/
+ java/
+ simple-bigbank/
+ bigbank.account - AccountComponent implementation
+ bigbank.accountdata - AccountDataComponent implementation
+ bigbank.client - starts the SCA Runtime and
+ deploys the BigBank.composite.
+ It then calls the deployed AccountService
+ resources/
+ BigBank.composite - the SCA assembly for this sample
+ simple-bigbank.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-bigbank
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID
+:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100]
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-bigbank
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running bigbank.BigBankTestCase
+Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234
+5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100]
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.592 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/build.xml
new file mode 100644
index 0000000000..a814014eae
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/build.xml
@@ -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.
+-->
+<project name="simple-bigbank" default="compile">
+ <property name="test.class" value="bigbank.client.BigBankClient" />
+ <property name="test.jar" value="sample-simple-bigbank.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/pom.xml
new file mode 100644
index 0000000000..aee4d6ee92
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-bigbank</artifactId>
+ <name>Apache Tuscany Simplified BigBank Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-databinding</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.png b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.png
new file mode 100644
index 0000000000..593c047f6a
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.svg b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.svg
new file mode 100644
index 0000000000..c64f6de6b9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/simple-bigbank.svg
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank"
+ sodipodi:docname="simple-bigbank.svg"
+ version="1.0"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-bigbank\simple-bigbank.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="468.4064"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="120"
+ inkscape:window-y="172" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">BigBank</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(84.32554,112.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Account</flowPara><flowPara
+ id="flowPara1883">Service</flowPara><flowPara
+ id="flowPara1885">Component</flowPara></flowRoot> <rect
+ style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:0.99999994;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect3006"
+ width="43.861084"
+ height="29.993773"
+ x="376.59262"
+ y="285.79593"
+ rx="21.930542"
+ ry="0" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 322.76581,342.58603 L 356.10085,342.58603 L 362.16176,355.71801 L 355.0907,367.83985 L 322.76581,367.83985 L 330.34196,355.71801 L 322.76581,342.58603 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1.00000012px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 226.73063,330.75341 L 280.61512,330.75341 L 290.41229,356.14253 L 278.98226,379.57867 L 226.73063,379.57867 L 238.97711,356.14253 L 226.73063,330.75341 z "
+ id="path1887" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1889"
+ width="115.66247"
+ height="85.862968"
+ x="557.25488"
+ y="308.38455"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1891"
+ transform="translate(301.6641,110.446)"><flowRegion
+ id="flowRegion1893"><rect
+ id="rect1895"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1897">Account</flowPara><flowPara
+ id="flowPara1909">Data</flowPara><flowPara
+ id="flowPara1899">Service</flowPara><flowPara
+ id="flowPara1901">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.10438,340.23154 L 573.43942,340.23154 L 579.50033,353.36352 L 572.42927,365.48536 L 540.10438,365.48536 L 547.68053,353.36352 L 540.10438,340.23154 z "
+ id="path1905" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 290,355.52305 C 329.28571,355.52305 329.28571,355.52305 329.28571,355.52305"
+ id="path1913" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 475,353.3802 C 547.14286,352.66591 547.14286,352.66591 547.14286,352.66591"
+ id="path1919" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1921"
+ transform="translate(95.23912,80.79069)"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1923"><rect
+ id="rect1925"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1931">currency</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot1933"
+ transform="translate(-42.61803,130.0764)"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans"><flowRegion
+ id="flowRegion1935"><rect
+ id="rect1937"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591"
+ style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans" /></flowRegion><flowPara
+ id="flowPara1939">Account</flowPara><flowPara
+ id="flowPara1941">Service</flowPara><flowPara
+ id="flowPara1943" /></flowRoot> </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java
new file mode 100644
index 0000000000..3f207e2f79
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.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 bigbank.account;
+
+import java.util.List;
+
+/**
+ */
+public class AccountReport {
+ private List<String> summaries;
+ private String currency;
+
+ public AccountReport(String currency, List<String> summaries) {
+ this.currency = currency;
+ this.summaries = summaries;
+ }
+
+ public List getAccountSummaries() { return summaries; }
+
+ public String getCurrency() { return currency; }
+
+ public String toString() {
+ return "currency: "+ currency + ", " + summaries;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java
new file mode 100644
index 0000000000..7c9082b944
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.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 bigbank.account;
+
+/**
+ * Interface for a account service
+ */
+public interface AccountService {
+ public AccountReport getAccountReport(String customerID);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java
new file mode 100644
index 0000000000..0d73a6c3c9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.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 bigbank.account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import bigbank.accountdata.AccountDataService;
+import bigbank.accountdata.CheckingAccount;
+import bigbank.accountdata.SavingsAccount;
+import bigbank.accountdata.StockAccount;
+
+/**
+ * Account service implementation
+ */
+@Service(AccountService.class)
+public class AccountServiceImpl implements AccountService {
+
+ @Reference
+ public AccountDataService accountDataService;
+
+ @Property
+ public String currency;
+
+ public AccountReport getAccountReport(String s) {
+ List<String> summaries = new ArrayList<String>();
+
+ CheckingAccount ca = accountDataService.getCheckingAccount(s);
+ summaries.add(ca.getSummary());
+
+ SavingsAccount sa = accountDataService.getSavingsAccount(s);
+ summaries.add(sa.getSummary());
+
+ StockAccount sk = accountDataService.getStockAccount(s);
+ summaries.add(sk.getSummary());
+
+ AccountReport report = new AccountReport(currency, summaries);
+
+ return report;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java
new file mode 100644
index 0000000000..a5ae7b3955
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.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 bigbank.accountdata;
+
+/**
+ * Interface for a account service
+ */
+public interface Account {
+ String getSummary();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java
new file mode 100644
index 0000000000..c354de387b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/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 bigbank.accountdata;
+
+/**
+ * Interface for a account data service
+ */
+public interface AccountDataService {
+ public CheckingAccount getCheckingAccount(String customerID);
+ public SavingsAccount getSavingsAccount(String customerID);
+ public StockAccount getStockAccount(String customerID);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java
new file mode 100644
index 0000000000..c8fc6277ca
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.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 bigbank.accountdata;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Account data service implementation
+ */
+@Service(AccountDataService.class)
+public class AccountDataServiceImpl implements AccountDataService {
+
+ public CheckingAccount getCheckingAccount(String customerID) {
+
+ CheckingAccount checkingAccount = new CheckingAccount();
+ checkingAccount.setAccountNumber(customerID+"_"+"CHA12345");
+ checkingAccount.setBalance(1500.0f);
+
+ return checkingAccount;
+ }
+
+ public SavingsAccount getSavingsAccount(String customerID) {
+
+ SavingsAccount savingsAccount = new SavingsAccount();
+ savingsAccount.setAccountNumber(customerID+"_"+"SAA12345");
+ savingsAccount.setBalance(1500.0f);
+
+ return savingsAccount;
+ }
+
+ public StockAccount getStockAccount(String customerID) {
+
+ StockAccount stockAccount = new StockAccount();
+ stockAccount.setAccountNumber(customerID+"_"+"STA12345");
+ stockAccount.setSymbol("IBM");
+ stockAccount.setQuantity(100);
+
+ return stockAccount;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java
new file mode 100644
index 0000000000..11bdff757e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.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 bigbank.accountdata;
+
+/**
+ * An account service implementation for a checking account
+ */
+public class CheckingAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java
new file mode 100644
index 0000000000..b791024076
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.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 bigbank.accountdata;
+
+/**
+ * An account service implementation for a savings account
+ */
+public class SavingsAccount implements Account {
+ private String accountNumber;
+ private double balance;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getBalance() { return balance; }
+ public void setBalance(double b) { this.balance = b; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java
new file mode 100644
index 0000000000..03df61772b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.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 bigbank.accountdata;
+
+/**
+ * An account service implementation for a stock account
+ */
+public class StockAccount implements Account {
+ private String accountNumber;
+ private String symbol;
+ private int quantity;
+
+ public String getAccountNumber() { return accountNumber; }
+ public void setAccountNumber(String n) { this.accountNumber = n; }
+
+ public double getQuantity() { return quantity; }
+ public void setQuantity(int a) { this.quantity = a; }
+
+ public String getSymbol() { return symbol; }
+ public void setSymbol(String s) { this.symbol = s; }
+
+ public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java
new file mode 100644
index 0000000000..edbf910d37
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.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 bigbank.client;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * and locate and invoke a SCA component
+ */
+public class BigBankClient {
+ public static void main(String[] args) throws Exception {
+
+ SCADomain scaDomain = SCADomain.newInstance("BigBank.composite");
+
+ AccountService accountService = scaDomain.getService(AccountService.class,
+ "AccountServiceComponent");
+
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+
+ scaDomain.close();
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/resources/BigBank.composite b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/resources/BigBank.composite
new file mode 100644
index 0000000000..ebebce5af9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/main/resources/BigBank.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"
+ name="BigBank">
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl"/>
+ <reference name="accountDataService" target="AccountDataServiceComponent"/>
+ <property name="currency">USD</property>
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.accountdata.AccountDataServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java
new file mode 100644
index 0000000000..42d780953d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.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 bigbank;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import bigbank.account.AccountService;
+
+/**
+ * Tests out the big bank service
+ *
+ */
+public class BigBankTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ AccountService accountService;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("BigBank.composite");
+ accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Account summary: " + accountService.getAccountReport("Foo") );
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/README b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/README
new file mode 100644
index 0000000000..5481d451e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/README
@@ -0,0 +1,93 @@
+Simple Callback Sample
+======================
+This sample demonstrates asynchronous messaging using a callback.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient
+
+
+Sample Overview
+---------------
+The sample provides a single composite with two components. MyClientComponent is
+wired to MyServiceComponent. The interface of MyServiceComponent describes one
+method as ONEWAY and with a callback semantic. When a message passes from
+client to service the response is returned via the callback asynchronously.
+
+simple-callback/
+ src/
+ main/
+ java/
+ simplecallback/
+ MyCient.java - client interface
+ MyClientImpl.java - implements the client and service callback
+ interfaces
+ MyService.java - service interface
+ MyServiceCallback.java - service callback interface, implemented by the
+ client
+ MyServiceImple.java - implements the service interface
+ SimpleCallbackClient.java - starts the SCA Runtime and
+ deploys the simplecallback.composite.
+ It then calls MyClientComponent which in turn
+ calls MyServiceComponent
+ resources/
+ simplecallbac.composite - the SCA assembly for this sample
+ simple-callback.png - a pictorial representation of the sample
+ .composite file
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd simple-callback
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Work thread Thread[pool-1-thread-1,5,main]
+ [java] Result: -> someMethod -> receiveResult
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd simple-callback
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running simplecallback.SimpleCallbackTestCase
+Main thread Thread[main,5,main]
+Sleeping ...
+Work thread Thread[pool-1-thread-1,5,main]
+Result: -> someMethod -> receiveResult
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.692 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/build.xml
new file mode 100644
index 0000000000..47d1ea4bc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/build.xml
@@ -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.
+-->
+<project name="simple-callback" default="compile">
+ <property name="test.class" value="simplecallback.SimpleCallbackClient" />
+ <property name="test.jar" value="sample-simple-callback.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/pom.xml
new file mode 100644
index 0000000000..5117ab78d6
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-simple-callback</artifactId>
+ <name>Apache Tuscany Simple Callback Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.png b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.png
new file mode 100644
index 0000000000..1b6353f5cf
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.svg b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.svg
new file mode 100644
index 0000000000..484b65df9d
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/simple-callback.svg
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback"
+ sodipodi:docname="simple-callback.svg"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="375"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1054"
+ inkscape:window-height="721"
+ inkscape:window-x="74"
+ inkscape:window-y="306" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997">
+ <rect
+ rx="15.307091"
+ ry="12.692303"
+ y="192.00233"
+ x="258.31146"
+ height="299.99988"
+ width="495.71429"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.99999964;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">simplecallback</flowPara></flowRoot> <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1883"
+ width="115.66247"
+ height="85.862968"
+ x="549.39777"
+ y="308.7417"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1885"
+ transform="translate(281.807,102.8031)"><flowRegion
+ id="flowRegion1887"><rect
+ id="rect1889"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1891">MyService</flowPara><flowPara
+ id="flowPara1915">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 532.24723,340.58867 L 565.58227,340.58867 L 571.64318,353.72065 L 564.57212,365.84249 L 532.24723,365.84249 L 539.82338,353.72065 L 532.24723,340.58867 z "
+ id="path1895" />
+ </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="339.91632"
+ y="310.73904"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(72.32554,104.8005)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">MyClient</flowPara><flowPara
+ id="flowPara1913">Component</flowPara></flowRoot> <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 436.01825,340.74775 L 469.35329,340.74775 L 475.4142,353.87973 L 468.34314,366.00157 L 436.01825,366.00157 L 443.5944,353.87973 L 436.01825,340.74775 z "
+ id="path3019" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 474.28571,353.3802 L 539.28571,354.09448"
+ id="path1917"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\simple-callback\simple-callback.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClient.java
new file mode 100644
index 0000000000..4cc00d6d0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClient.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 simplecallback;
+
+/**
+ * The client interface
+ */
+public interface MyClient {
+
+ void aClientMethod();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java
new file mode 100644
index 0000000000..3e2a1df5a5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.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 simplecallback;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Demonstrates a component-to-component callback invocation
+ */
+@Service(MyClient.class)
+@Scope("COMPOSITE")
+public class MyClientImpl implements MyClient, MyServiceCallback {
+
+ private MyService myService;
+ static String result;
+
+ @Reference
+ public void setMyService(MyService myService) {
+ this.myService = myService;
+ }
+
+ public void aClientMethod() {
+ myService.someMethod("-> someMethod");
+ }
+
+ public void receiveResult(String result) {
+ System.out.println("Work thread " + Thread.currentThread());
+ System.out.println("Result: " + result);
+ MyClientImpl.result = result;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyService.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyService.java
new file mode 100644
index 0000000000..e78ad6f68f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyService.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 simplecallback;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * This service that will be invoked in a non-blocking fashion
+ */
+@Callback(MyServiceCallback.class)
+public interface MyService {
+
+ @OneWay
+ void someMethod(String arg);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java
new file mode 100644
index 0000000000..b27eea44f5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.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 simplecallback;
+
+/**
+ * The callback interface for {@link MyService}.
+ */
+public interface MyServiceCallback {
+
+ void receiveResult(String result);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java
new file mode 100644
index 0000000000..fc5e31d14e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.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 simplecallback;
+
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements MyService and uses a callback.
+ */
+@Service(MyService.class)
+@Scope("COMPOSITE")
+public class MyServiceImpl implements MyService {
+
+ private MyServiceCallback myServiceCallback;
+
+ /**
+ * The setter used by the runtime to set the callback reference
+ * @param myServiceCallback
+ */
+ @Callback
+ public void setMyServiceCallback(MyServiceCallback myServiceCallback) {
+ this.myServiceCallback = myServiceCallback;
+ }
+
+ public void someMethod(String arg) {
+ // invoke the callback
+ try {
+ myServiceCallback.receiveResult(arg + " -> receiveResult");
+ } catch(RuntimeException e) {
+ System.out.println("RuntimeException invoking receiveResult: " + e.toString());
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java
new file mode 100644
index 0000000000..b8987fcd07
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.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 simplecallback;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackClient {
+
+ public static void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite");
+ MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ Thread.sleep(500);
+
+ scaDomain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/resources/simplecallback.composite b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/resources/simplecallback.composite
new file mode 100644
index 0000000000..33e6f60601
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/main/resources/simplecallback.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"
+ targetNamespace="http://simplecallback"
+ xmlns:cb="http://simplecallback"
+ name="simplecallback">
+
+ <component name="MyClientComponent">
+ <implementation.java class="simplecallback.MyClientImpl"/>
+ <reference name="myService" target="MyServiceComponent"/>
+ </component>
+
+ <component name="MyServiceComponent">
+ <implementation.java class="simplecallback.MyServiceImpl"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java
new file mode 100644
index 0000000000..cafa1bf2fb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.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 simplecallback;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * A testcase that demonstrates resolving the client service and initiating the callback sequence
+ */
+public class SimpleCallbackTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private MyClient myClient;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("simplecallback.composite");
+ myClient = scaDomain.getService(MyClient.class, "MyClientComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+ System.out.println("Main thread " + Thread.currentThread());
+ myClient.aClientMethod();
+ System.out.println("Sleeping ...");
+ Thread.sleep(300);
+ assertEquals("-> someMethod -> receiveResult", MyClientImpl.result);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/README b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/README
new file mode 100644
index 0000000000..9e7b13c664
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/README
@@ -0,0 +1,97 @@
+SupplyChain Sample
+==================
+
+This sample demonstrates using the SCA components using the asynchronous API.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you just want to run it to see what happens open a command prompt, navigate
+to this sample directory and do:
+
+ant run
+
+OR if you don't have ant, on Windows do
+
+java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-supplychain.jar supplychain.SupplyChainClient
+
+and on *nix do
+
+java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-supplychain.jar supplychain.SupplyChainClient
+
+
+Sample Overview
+---------------
+
+The sample provides a Customer service with a purchaseGoods operation
+and a notifyShipment operation annotated with the SCA @OneWay annotation.
+The SupplyChainClient exercises this interface by calling the
+purchaseGoods operation. This results in messages passing to
+the Retailer, Warehouse, and Shipper components and the result returned
+to the Customer service on a seperate callback thread.
+
+calculator/
+ src/
+ main/
+ java/
+ supplychain/
+ Customer.java - Defines the Java interface implemented
+ by the Customer component
+ CustomerComponentImpl.java - Implements the SCA Customer component
+ Retailer.java - Defines the Java interface implemented
+ by the Retailer component
+ RetailerComponentImpl.java - Implements the SCA RetailerComponent component
+ Shipper.java - Defines the Java interface implemented
+ by the Shipper component
+ ShipperComponentImpl.java - Implements the SCA ShipperComponent component
+ SupplyChainClient.java - SupplyChainClient.java loads SCA runtime
+ Warehouse.java - Defines the Java interface implemented
+ by the Warehouse component
+ WarehouseComponentImpl.java - Implements the SCA WarehouseComponent component
+
+ resources/
+ supplychain.composite - the SCA assembly for this sample
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as
+follows
+
+cd calculator
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+ [java] Main thread Thread[main,5,main]
+ [java] Main thread sleeping ...
+ [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped
+
+Building And Running The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built and run
+using Maven as follows.
+
+cd supplychain
+mvn
+
+You should see the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running supplychain.SupplyChainClientTestCase
+Main thread Thread[main,5,main]
+Sleeping ...
+Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.625 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/build.xml b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/build.xml
new file mode 100644
index 0000000000..506180b8b1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/build.xml
@@ -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.
+-->
+<project name="sample-supplychain" default="compile">
+ <property name="test.class" value="supplychain.SupplyChainClient" />
+ <property name="test.jar" value="sample-supplychain.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run-classes">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/classes"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="run">
+ <java classname="${test.class}"
+ fork="true">
+ <classpath>
+ <pathelement path="target/${test.jar}"/>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/pom.xml b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/pom.xml
new file mode 100644
index 0000000000..0a72a29efb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/pom.xml
@@ -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>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-supplychain</artifactId>
+ <name>Apache Tuscany Supply Chain Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.90-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Customer.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Customer.java
new file mode 100644
index 0000000000..8088001898
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Customer.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 supplychain;
+
+import org.osoa.sca.annotations.OneWay;
+
+/**
+ * This is the business interface of the Customer service component.
+ */
+public interface Customer {
+
+ public void purchaseGoods();
+
+ @OneWay
+ public void notifyShipment(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java
new file mode 100644
index 0000000000..7a1e8553ec
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.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 supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class CustomerComponentImpl implements Customer {
+
+ private Retailer retailer;
+
+ @Reference
+ public void setRetailer(Retailer retailer) {
+ this.retailer = retailer;
+ }
+
+ public void purchaseGoods() {
+ retailer.submitOrder("Order");
+ }
+
+ public void notifyShipment(String order) {
+ System.out.print("Work thread " + Thread.currentThread() + " - ");
+ System.out.println(order);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Retailer.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Retailer.java
new file mode 100644
index 0000000000..1add63fb4e
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Retailer.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 supplychain;
+
+/**
+ * This is the business interface of the Retailer service component.
+ */
+public interface Retailer {
+
+ public void submitOrder(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java
new file mode 100644
index 0000000000..f622052cf8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.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 supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Customer service component.
+ */
+public class RetailerComponentImpl implements Retailer {
+
+ private Warehouse warehouse;
+
+ @Reference
+ public void setWarehouse(Warehouse warehouse) {
+ this.warehouse = warehouse;
+ }
+
+ public void submitOrder(String order) {
+ warehouse.fulfillOrder(order + ", submitted");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Shipper.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Shipper.java
new file mode 100644
index 0000000000..d4d49a922b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Shipper.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 supplychain;
+
+/**
+ * This is the business interface of the Shipper service component.
+ */
+public interface Shipper {
+
+ public void processShipment(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java
new file mode 100644
index 0000000000..4ae52a12a2
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.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 supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+public class ShipperComponentImpl implements Shipper {
+
+ private Customer customer;
+
+ @Reference
+ public void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ public void processShipment(String order) {
+ customer.notifyShipment(order + ", shipped");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java
new file mode 100644
index 0000000000..7072f582d1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/SupplyChainClient.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 supplychain;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a Customer service component and invoke it.
+ */
+public class SupplyChainClient {
+
+ public static final void main(String[] args) throws Exception {
+ SCADomain scaDomain = SCADomain.newInstance("supplychain.composite");
+ Customer customer = scaDomain.getService(Customer.class, "CustomerComponent");
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseGoods();
+ System.out.println("Main thread sleeping ...");
+ Thread.sleep(1000);
+
+ scaDomain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Warehouse.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Warehouse.java
new file mode 100644
index 0000000000..0be499f569
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/Warehouse.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 supplychain;
+
+/**
+ * This is the business interface of the Warehouse service component.
+ */
+public interface Warehouse {
+
+ public void fulfillOrder(String order);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java
new file mode 100644
index 0000000000..b5e256a1e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.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 supplychain;
+
+import org.osoa.sca.annotations.Reference;
+
+/**
+ * This class implements the Warehouse service component.
+ */
+public class WarehouseComponentImpl implements Warehouse {
+
+ private Shipper shipper;
+
+ @Reference
+ public void setShipper(Shipper shipper) {
+ this.shipper = shipper;
+ }
+
+ public void fulfillOrder(String order) {
+ shipper.processShipment(order + ", fulfilled");
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/resources/supplychain.composite b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/resources/supplychain.composite
new file mode 100644
index 0000000000..301efcaf1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/main/resources/supplychain.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"
+ targetNamespace="http://supplychain"
+ xmlns:sp="http://supplychain"
+ name="supplychain">
+
+ <component name="CustomerComponent">
+ <implementation.java class="supplychain.CustomerComponentImpl" />
+ <reference name="retailer" target="RetailerComponent"/>
+ </component>
+
+ <component name="RetailerComponent">
+ <implementation.java class="supplychain.RetailerComponentImpl" />
+ <reference name="warehouse" target="WarehouseComponent"/>
+ </component>
+
+ <component name="WarehouseComponent">
+ <implementation.java class="supplychain.WarehouseComponentImpl" />
+ <reference name="shipper" target="ShipperComponent"/>
+ </component>
+
+ <component name="ShipperComponent">
+ <implementation.java class="supplychain.ShipperComponentImpl" />
+ <reference name="customer" target="CustomerComponent"/>
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java
new file mode 100644
index 0000000000..d7421e9889
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.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 supplychain;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate a the Customer service component and invoke it.
+ */
+public class SupplyChainClientTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private Customer customer;
+
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("supplychain.composite");
+ customer = scaDomain.getService(Customer.class, "CustomerComponent");
+ }
+
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void test() throws Exception {
+
+ System.out.println("Main thread " + Thread.currentThread());
+ customer.purchaseGoods();
+ System.out.println("Sleeping ...");
+ Thread.sleep(1000);
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.png b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.png
new file mode 100644
index 0000000000..51a384e827
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.png
Binary files differ
diff --git a/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.svg b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.svg
new file mode 100644
index 0000000000..f72e77acab
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.90/samples/supplychain/supplychain.svg
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT 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 with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44"
+ sodipodi:docbase="C:\simon\Projects\Tuscany\java\java-head\sca\samples\supplychain"
+ sodipodi:docname="supplychain.svg"
+ version="1.0">
+ <defs
+ id="defs4" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="521.44872"
+ inkscape:cy="414.63224"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ inkscape:window-width="1128"
+ inkscape:window-height="721"
+ inkscape:window-x="89"
+ inkscape:window-y="126" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g2997"
+ transform="matrix(1.047575,0,0,1,-9.726882,0)">
+ <rect
+ rx="19.999123"
+ ry="12.692303"
+ y="192.00233"
+ x="205.45438"
+ height="299.99988"
+ width="647.66394"
+ id="rect2067"
+ style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:1.95405793;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
+ <flowRoot
+ id="flowRoot2954"
+ xml:space="preserve"
+ transform="translate(-38.86527,-2.857143)"><flowRegion
+ id="flowRegion2956"><rect
+ y="212.66591"
+ x="281.42856"
+ height="61.42857"
+ width="170"
+ id="rect2958" /></flowRegion><flowPara
+ id="flowPara2960">supplychain</flowPara></flowRoot> </g>
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect2988"
+ width="115.66247"
+ height="85.862968"
+ x="241.34489"
+ y="300.02475"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot2966"
+ transform="translate(-26.24589,94.08621)"><flowRegion
+ id="flowRegion2968"><rect
+ id="rect2970"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara2972">Customer</flowPara><flowPara
+ id="flowPara1939">Component</flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 224.19438,331.87174 L 257.52942,331.87174 L 263.59033,345.00372 L 256.51927,357.12556 L 224.19438,357.12556 L 231.77053,345.00372 L 224.19438,331.87174 z "
+ id="path3017" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 337.44682,330.03346 L 370.78186,330.03346 L 376.84277,343.16544 L 369.77171,355.28728 L 337.44682,355.28728 L 345.02297,343.16544 L 337.44682,330.03346 z "
+ id="path3019" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1897"
+ width="115.66247"
+ height="85.862968"
+ x="405.82632"
+ y="298.30585"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1899"
+ transform="translate(138.2355,92.36731)"><flowRegion
+ id="flowRegion1901"><rect
+ id="rect1903"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1905">Retailer</flowPara><flowPara
+ id="flowPara1941">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 388.67581,330.15284 L 422.01085,330.15284 L 428.07176,343.28482 L 421.0007,355.40666 L 388.67581,355.40666 L 396.25196,343.28482 L 388.67581,330.15284 z "
+ id="path1907" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 501.92825,328.31456 L 535.26329,328.31456 L 541.3242,341.44654 L 534.25314,353.56838 L 501.92825,353.56838 L 509.5044,341.44654 L 501.92825,328.31456 z "
+ id="path1909" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1911"
+ width="115.66247"
+ height="85.862968"
+ x="567.96918"
+ y="296.87729"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1913"
+ transform="translate(300.3784,90.93874)"><flowRegion
+ id="flowRegion1915"><rect
+ id="rect1917"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1919">Wharehouse</flowPara><flowPara
+ id="flowPara1943">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 550.81867,328.72427 L 584.15371,328.72427 L 590.21462,341.85625 L 583.14356,353.97809 L 550.81867,353.97809 L 558.39482,341.85625 L 550.81867,328.72427 z "
+ id="path1921" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 664.07111,326.88599 L 697.40615,326.88599 L 703.46706,340.01797 L 696.396,352.13981 L 664.07111,352.13981 L 671.64726,340.01797 L 664.07111,326.88599 z "
+ id="path1923" />
+ <rect
+ style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="rect1925"
+ width="115.66247"
+ height="85.862968"
+ x="727.96918"
+ y="294.73444"
+ rx="6.9961648"
+ ry="7.1230249" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot1927"
+ transform="translate(460.3784,88.79589)"><flowRegion
+ id="flowRegion1929"><rect
+ id="rect1931"
+ width="170"
+ height="61.42857"
+ x="281.42856"
+ y="212.66591" /></flowRegion><flowPara
+ id="flowPara1933">Shipper</flowPara><flowPara
+ id="flowPara1945">Component </flowPara></flowRoot> <path
+ style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 710.81866,326.58142 L 744.1537,326.58142 L 750.21461,339.7134 L 743.14355,351.83524 L 710.81866,351.83524 L 718.39481,339.7134 L 710.81866,326.58142 z "
+ id="path1935" />
+ <path
+ style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 824.0711,324.74314 L 857.40614,324.74314 L 863.46705,337.87512 L 856.39599,349.99696 L 824.0711,349.99696 L 831.64725,337.87512 L 824.0711,324.74314 z "
+ id="path1937" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 376.42857,343.3802 C 395.71429,343.3802 395.71429,343.3802 395.71429,343.3802"
+ id="path1947" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 540.71429,341.23734 C 557.85714,341.23734 557.85714,341.23734 557.85714,341.23734"
+ id="path1949" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 702.14286,340.52305 C 717.85714,340.52305 717.85714,340.52305 717.85714,340.52305"
+ id="path1951" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 863.57143,337.66591 C 875.71429,337.66591 875.71429,337.66591 875.71429,337.66591 L 875,427.66591 L 212.14286,429.09448 L 210.71429,344.09448 L 231.42857,344.09448"
+ id="path1953"
+ inkscape:export-filename="C:\simon\Projects\Tuscany\java\java-head\sca\samples\supplychain\supplychain.png"
+ inkscape:export-xdpi="52.84"
+ inkscape:export-ydpi="52.84" />
+ </g>
+</svg>